objective_fun: Function to be Optimize

View source: R/MortalityLaw_main.R

objective_funR Documentation

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

Life table 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 used. 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 6 other loss functions. For more details, check the availableLF function.

custom.law

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

Value

The optimal value


MortalityLaws documentation built on Aug. 8, 2023, 5:10 p.m.