Extract the Log-Likelihood of a Fitted Mortality Law
Source:R/MortalityLaw_S3.R
logLik.MortalityLaw.RdReturns the maximised log-likelihood of a "MortalityLaw" fit. It is
only defined when the objective was a likelihood, that is when the model
was fitted with opt.method = "poissonL" or "binomialL"; for
the loss-function objectives the value is NaN. For a multiple fit
the log-likelihoods are returned as a named vector.
Usage
# S3 method for class 'MortalityLaw'
logLik(object, ...)Value
An object of class "logLik" for a single fit, or a named
numeric vector of log-likelihoods for a multiple fit.
Examples
x <- 45:75
M1 <- MortalityLaw(x = x, Dx = ahmd$Dx[as.character(x), "1950"],
Ex = ahmd$Ex[as.character(x), "1950"],
law = "makeham", opt.method = "poissonL")
logLik(M1)
#> 'log Lik.' -578479.4 (df=3)