GompertzMakeham | R Documentation |
Implementing Gompertz-Makeham's model mortality function of the force of mortality u(x) with conversion into qx and fitting the model to actual qx of given lifetable.
GompertzMakeham(A, B, C, t)
fitGM(initialpar=c(0.01, 0.0003, 0.07), data, mode=1, Method="Nelder-Mead", ...)
A |
The parameter A of the Gompertz-Makeham model u(t)=A*exp(B*t)+C. |
B |
The parameter B of the Gompertz-Makeham model u(t)=A*exp(B*t)+C. |
C |
The parameter C of the Gompertz-Makeham model u(t)=A*exp(B*t)+C. |
t |
Age (vector OK) in years |
initialpar |
Initial value for the parameters to be estimated. If not given, c(0.01, 0.0003, 0.07) is used. |
data |
Actual vector of qx in the lifetable to be used to obtain the best-fit parameters of the Gompertz-Makeham model. |
mode |
Which of lifetable functions should be used to calculate the RMSE, which is to be minimized in optim() function: 1 qx, 2 dx, otherwise lx. Default is 1. |
Method |
The method to be used in optim() function. Default is "Nelder-Mead". |
... |
Other options to be passed to optim(). |
GompertzMakeham() returns model qx for the same length with t, where u(x) is internally converted into qx. fitGM() returns the numeric vector of fitted parameters of A, B and C, RMSE for those values, and the flag of convergence.
Minato Nakazawa minatonakazawa@gmail.com https://minato.sip21c.org/
Jlife
res <- fitGM(,Jlife$qx2005M)
FLAG <- res[5]
while (FLAG>0) {
res <- fitGM(res[1:3], Jlife$qx2005M)
FLAG <- res[5]
}
print(res)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.