This function extract the log-likelihood from the output of a estimate call. The extracted log-likelihood correspond to the value in the last iteration of the estimate call, users should check convergence of the Gauss/Fisher scoring method before using the log-likelihood statistic to compare models.

# S3 method for class 'result.goldfish'
logLik(object, ..., avgPerEvent = FALSE)

Arguments

object

an object of class result.goldfish output from an estimate call with a fitted model.

...

additional arguments to be passed.

avgPerEvent

a logical value indicating whether the average likelihood per event should be calculated.

Value

Returns an object of class logLik when avgPerEvent = FALSE. This is a number with the extracted log-likelihood from the fitted model, and with the following attributes:

df

degrees of freedom with the number of estimated parameters in the model

nobs

the number of observations used in estimation. In general, it corresponds to the number of dependent events used in estimation. For a subModel = "rate" or model = "REM" with intercept, it corresponds to the number of dependent events plus right-censored events due to exogenous or endogenous changes.

When avgPerEvent = TRUE, the function returns a number with the average log-likelihood per event. The total number of events depends on the presence of right-censored events in a similar way that the attribute nobs is computed when avgPerEvent = FALSE.

Details

Users might use stats::AIC() and stats::BIC() to compute the Information Criteria from one or several fitted model objects. An information criterion could be used to compare models with respect to their predictive power.

Alternatively, lmtest::lrtest() can be used to compare models via asymptotic likelihood ratio tests. The test is designed to compare nested models. i.e., models where the model specification of one contains a subset of the predictor variables that define the other.