R/extract.R

Defines functions nobs.aftreg nobs.phreg nobs.coxreg extractAIC.aftreg extractAIC.phreg extractAIC.coxreg

#' @export 
extractAIC.coxreg <- function(fit, scale, k = 2, ...) 
{
    edf <- sum(fit$df)
    loglik <- fit$loglik[length(fit$loglik)]
    c(edf, -2 * loglik + k * edf)
}

#' @export
extractAIC.phreg <- function(fit, scale, k = 2, ...) 
{
    edf <- length(fit$coefficients)
    loglik <- fit$loglik[length(fit$loglik)]
    c(edf, -2 * loglik + k * edf)
}

#' @export
extractAIC.aftreg <- function(fit, scale, k = 2, ...) 
{
    edf <- sum(fit$df)
    loglik <- fit$loglik[length(fit$loglik)]
    c(edf, -2 * loglik + k * edf)
}

#' @export
nobs.coxreg <- function(object, ...){
    object$n.events
}

#' @export
nobs.phreg <- function(object, ...){
    object$n
}

#' @export
nobs.aftreg <- function(object, ...){
    object$n
}

Try the eha package in your browser

Any scripts or data that you put into this service are public.

eha documentation built on Oct. 1, 2023, 1:07 a.m.