Learn R Programming

MortalityLaws (version 2.2.0)

choose_optim: Run the optimisation routine

Description

This is the core optimisation function for MortalityLaw. It:

  1. Subsets the data to the fitting ages (fit.this.x).

  2. Scales the age vector if required by the chosen model.

  3. Obtains default starting parameters (if not provided).

  4. Minimises the objective function using nlminb (PORT routines) with the parameters on the log scale.

  5. Transforms parameters back to the original scale, computes the fitted hazard, and derives goodness-of-fit measures (AIC, BIC, log-likelihood) where applicable.

Usage

choose_optim(input)

Value

A list with components:

x

Age vector (original).

new.x

Age vector after optional scaling.

opt

Object returned by nlminb.

C

Estimated parameters on the original scale.

hx

Fitted hazard values evaluated at new.x.

logLik, AIC, BIC

Goodness-of-fit measures (NaN for non-likelihood methods).

Arguments

input

A list containing all input arguments to MortalityLaw.