Learn R Programming

fmsb (version 0.7.6)

GompertzMakeham: Gompertz-Makeham's model mortality for u(x) and its fitting

Description

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.

Usage

GompertzMakeham(A, B, C, t)
 fitGM(initialpar=c(0.01, 0.0003, 0.07), data, mode=1, Method="Nelder-Mead", ...)

Value

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.

Arguments

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().

See Also

Jlife

Examples

Run this code
 res <- fitGM(,Jlife$qx2005M)
 FLAG <- res[5]
 while (FLAG>0) {
   res <- fitGM(res[1:3], Jlife$qx2005M)
   FLAG <- res[5]
 }
 print(res)

Run the code above in your browser using DataLab