Closed spedygiorgio closed 8 years ago
In the coming days, I can make a test file to show the bug and then fix it.
Christophe Dutang LMM, UdM, Le Mans, France web: http://dutangc.free.fr http://dutangc.free.fr/
Le 13 oct. 2015 à 21:29, Giorgio Alfredo Spedicato notifications@github.com a écrit :
Dear Giorgo, With respect to the second bug, I suggest these changes in the code of the functions pxt and Axn. The reason for the pxt function is that if I use it with a lifetable that has the last probability px greater than zero, the result is incorrect, but if I use a vector of qx's that has the last probability equal to one, and if I convert it to a lifetable with the probs2lifetable function, the result is correct. Axn function (actuarialtable, x, n, i = actuarialtable@interest, m, k = 1, type = "EV", power = 1) { [...] if (missing(n)) n = getOmega(actuarialtable) - x - m + 1 [...] }
pxt function (object, x, t, fractional = "linear", decrement) { [...]
if((tabla@lx[omega]>0) && (x + t) == (omega+1) )
{out <- 1/object@lx[which(object@x == x)]}
else {
if ((x + t) > omega) out <- 0
[...]
}
— Reply to this email directly or view it on GitHub https://github.com/spedygiorgio/lifecontingencies/issues/2.
Thank you very much :-)
2015-10-15 21:43 GMT+02:00 Christophe Dutang notifications@github.com:
In the coming days, I can make a test file to show the bug and then fix it.
Christophe Dutang LMM, UdM, Le Mans, France web: http://dutangc.free.fr http://dutangc.free.fr/
Le 13 oct. 2015 à 21:29, Giorgio Alfredo Spedicato < notifications@github.com> a écrit :
Dear Giorgo, With respect to the second bug, I suggest these changes in the code of the functions pxt and Axn. The reason for the pxt function is that if I use it with a lifetable that has the last probability px greater than zero, the result is incorrect, but if I use a vector of qx's that has the last probability equal to one, and if I convert it to a lifetable with the probs2lifetable function, the result is correct. Axn function (actuarialtable, x, n, i = actuarialtable@interest, m, k = 1, type = "EV", power = 1) { [...] if (missing(n)) n = getOmega(actuarialtable) - x - m + 1 [...] }
pxt function (object, x, t, fractional = "linear", decrement) { [...]
if((tabla@lx[omega]>0) && (x + t) == (omega+1) )
{out <- 1/object@lx[which(object@x == x)]}
else {
if ((x + t) > omega) out <- 0
[...]
}
— Reply to this email directly or view it on GitHub < https://github.com/spedygiorgio/lifecontingencies/issues/2>.
— Reply to this email directly or view it on GitHub https://github.com/spedygiorgio/lifecontingencies/issues/2#issuecomment-148500512 .
Dear Giorgo, With respect to the second bug, I suggest these changes in the code of the functions pxt and Axn. The reason for the pxt function is that if I use it with a lifetable that has the last probability px greater than zero, the result is incorrect, but if I use a vector of qx's that has the last probability equal to one, and if I convert it to a lifetable with the probs2lifetable function, the result is correct. Axn function (actuarialtable, x, n, i = actuarialtable@interest, m, k = 1, type = "EV", power = 1) { [...] if (missing(n)) n = getOmega(actuarialtable) - x - m + 1 [...] }
pxt function (object, x, t, fractional = "linear", decrement) { [...]
if((tabla@lx[omega]>0) && (x + t) == (omega+1) )
{out <- 1/object@lx[which(object@x == x)]}
else {
if ((x + t) > omega) out <- 0
[...]
}