Learn R Programming

MortalityLaws (version 1.4.0)

objective_fun: Function to be Optimize

Description

Function to be Optimize

Usage

objective_fun(par, x, Dx, Ex, mx, qx, law, opt.method, custom.law)

Arguments

x

Vector of ages at the beginning of the age interval.

Dx

Object containing death counts. An element of the Dx object, represents the number of deaths during the year to persons aged x to x+n.

Ex

Exposure in the period. Ex can be approximated by the mid-year population aged x to x+n.

mx

Death rate in age interval [x, x+n).

qx

Probability of dying in age interval [x, x+n).

law

The name of the mortality law/model to be fitted. e.g. gompertz, makeham, ... To investigate all the possible options, see availableLaws function.

opt.method

How would you like to find the parameters? Specify the function to be optimize. Available options: the Poisson likelihood function poissonL; the Binomial likelihood function -binomialL; and other 6 loss functions. For more details, check availableLF function.

custom.law

Allows you to fit a model that is not defined in the package. Accepts as input a function.