Learn R Programming

epifit (version 0.1.2)

AIC.epifit: Function for calculating Akaike's ‘An Information Criterion’ (AIC) from epifit object.

Description

Function called from generic function AIC in stats when the argument is epifit object.

Usage

"AIC"(object, ..., k = 2)

Arguments

object
a fitted epifit object.
...
not used in this version, only for compatibility purpose with generic function AIC currently.
k
numeric, the penalty per parameter to be used; the default k = 2 is the classical AIC.

Value

a numeric AIC value.

See Also

AIC.

Examples

Run this code
library(survival)
# The simplest test data set from coxph function
test1 <- list(time=c(4,3,1,1,2,2,3),
              status=c(1,1,1,0,1,1,0),
              x=c(0,2,1,1,1,0,0),
              sex=c(0,0,0,0,1,1,1))
AIC(coxph(Surv(time,status)~x + strata(sex), data=test1))
modelexpr <- "cox(time,status)/strata(sex)~exp(beta*x)"
AIC(epifit(modelexpr=modelexpr, data=test1))

Run the code above in your browser using DataLab