Skip to contents

Fits a Gompertz distribution with proportional hazards to doubly-truncated mortality data using maximum likelihood estimation.

Usage

gompertz_mle(
  formula,
  left_trunc = 1975,
  right_trunc = 2005,
  data,
  byear = byear,
  dyear = dyear,
  lower_age_bound = NULL,
  upper_age_bound = NULL,
  weights = NULL,
  start = NULL,
  death_age_data_type = "auto",
  maxiter = 10000
)

Arguments

formula

the estimation formula

left_trunc

left truncation year

right_trunc

right truncation year

data

a data frame containing variables in the model

byear

vector of birth years

dyear

vector of death years

lower_age_bound

lowest age at death to include (optional)

upper_age_bound

highest age at death to include (optional)

weights

an optional vector of individual weights

start

an optional vector of starting values for the optimizer. must be a numeric vector that exactly matches the output of get.par.start(formula, data) in length and element names.

death_age_data_type

option for handling of continuous and discrete death age variable (not yet implemented)

maxiter

maximum number of iterations for optimizer

Value

Returns a named list consisting of the following components (See stats::optim() for additional details):

starting_values

list of starting values of parameters

optim_fit

A list consisting of:

par

best estimation of parameter values

value

log likelihood

counts

number of calls to function and gradient

convergence

returns 0 if the model converged, for other values see stats::optim()

message

any other information returned by optimizer

hessian

Hessian matrix

results

A table of estimates and upper/lower bounds of the 95 percent confidence interval for the estimates. Confidence interval computed as 1.96*standard_error.

Examples

if (FALSE) {
#model hazards as function of birthplace using bunmd_demo file
gompertz_mle(formula = death_age ~ bpl_string, left_trunc = 1988, right_trunc = 2005,
data = bunmd_demo)
}