Learn R Programming

xpose.xtras (version 0.2.2)

logLik.xpose_data: Log-likelihood, AIC and BIC for xpose_data objects

Description

[Experimental]

NONMEM (and nlmixr2) objective function values (OFV) are -2*log-likelihood, so the log-likelihood of a model is derived as -ofv/2. The number of estimated parameters (thetas, and unfixed omegas/sigmas) is used as the degrees of freedom.

Because <stats::AIC> and <stats::BIC> dispatch through <stats::logLik> by default, only logLik.xpose_data needs to be defined here for AIC()/BIC() to work as expected on xpose_data/xp_xtras objects; no AIC/BIC methods are defined for a single model.

Not calculable for a model-averaged ("franken") xpose_data object (eg, the output of <modavg_xpdb>), since such an object does not correspond to a single fitted model; an error is thrown instead.

Usage

# S3 method for xpose_data
logLik(object, .problem = NULL, .subprob = NULL, .method = NULL, ...)

Value

<logLik> object, as documented in <stats::logLik>, with "df"

(number of estimated parameters) and "nobs" (number of observations) attributes set.

Arguments

object

<xpose_data> or <xp_xtras> object

.problem

<numeric> Problem number to use. Uses the xpdb default if not provided.

.subprob

<numeric> Subproblem number to use. Uses the xpdb default if not provided.

.method

<numeric> Method to use. Uses the xpdb default if not provided.

...

Not used.

Examples

Run this code

logLik(xpdb_x)
AIC(xpdb_x)
BIC(xpdb_x)

Run the code above in your browser using DataLab