Learn R Programming

MortalityLaws (version 2.2.0)

addDetails: Retrieve model-specific details for fitting

Description

Based on the chosen mortality law (or a custom law), this function retrieves the default starting parameters, the model information table, and whether the age vector should be scaled before fitting.

Usage

addDetails(law, custom.law = NULL, parS = NULL)

Value

A list with components:

law

Internal law name (e.g., "custom.law" for user-supplied functions).

parS

Starting parameter values for the optimisation.

model

Model information data frame (from availableLaws) or "Custom Mortality Law" for user-defined models.

scale.x

Logical; whether the age vector should be re-scaled (x = x - min(x) + 1) before fitting.

Arguments

law

The name of the mortality law to be used (e.g., "gompertz", "makeham"). Run availableLaws to see all options.

custom.law

A user-defined function for fitting a model not included in the package. The function must accept arguments x (age vector) and par (named parameter vector) and return a list containing at least an element named hx (the hazard or force of mortality). See the examples below.

parS

Optional starting parameter values for the optimisation. If NULL, sensible defaults are automatically chosen via bring_parameters.