Learn R Programming

AICcmodavg (version 1.26)

extract.LL: Extract Log-Likelihood of Model

Description

This function extracts the log-likelihood from an object of 'coxph' or various 'unmarkedFit' classes.

Usage

extract.LL(mod)
extract.LL.coxph(mod)
extract.LL.unmarked(mod)

Arguments

mod
an object of 'coxph' or 'unmarkedFit' class resulting from the fit of 'distsamp', 'gdistsamp', 'occu', 'occuRN', 'colext', 'pcount', or 'pcountOpen'

Value

  • 'extract.LL.coxph' and 'extract.LL.unmarked' return the value of the log-likelihood of the model and associated degrees of freedom.

Details

This utility function extracts the information from a 'coxph' or 'unmarkedFit' object resulting from 'distsamp', 'gdistsamp', 'occu', 'occuRN', 'colext', 'pcount', or 'pcountOpen'.

See Also

AICc, aictab, coxph, distsamp, gdistsamp, occu, occuRN, colext, pcount, pcountOpen

Examples

Run this code
##modified example of single-season model with heterogeneity from ?occuRN
require(unmarked)
data(birds)
woodthrushUMF <- unmarkedFrameOccu(woodthrush.bin)

##survey occasion-specific detection probabilities
fm.wood.rn <- occuRN(~ obsNum ~ 1, woodthrushUMF)

##extract log-likelihood
extract.LL(fm.wood.rn)

detach(package:unmarked)


##modified example of Cox regression from ?coxph
require(survival)
##Create a simple data set for a time-dependent model
test2 <- list(start=c(1, 2, 5, 2, 1, 7, 3, 4, 8, 8),
              stop =c(2, 3, 6, 7, 8, 9, 9, 9,14,17),
              event=c(1, 1, 1, 1, 1, 1, 1, 0, 0, 0),
              x    =c(1, 0, 0, 1, 0, 1, 1, 1, 0, 0) )
m.cox <- coxph(Surv(start, stop, event) ~ x, test2)
extract.LL(m.cox)
detach(package:survival)

Run the code above in your browser using DataLab