logpl {survcomp}R Documentation

Function to compute the log partial likelihood of a Cox model

Description

The function computes the log partial likelihood of a set of coefficients given some survival data.

Usage

logpl(surv.time, surv.event, beta, x, strata.cox = NULL, na.rm = FALSE, verbose = FALSE)

Arguments

surv.time vector of times to event occurrence
surv.event vector of indicators for event occurrence
beta vector of coefficients fitted by a Cox model for instance
x data matrix
strata.cox stratification variable
na.rm TRUE if the missing values should be removed from the data, FALSE otherwise
verbose verbosity of the function

Value

vectorof two elements: logpl and event for the estimation of the log partial likelihood and the number of events, respectively

Author(s)

Benjamin Haibe-Kains

References

Cox, D. R. (1972) "Regression Models and Life Tables", Journal of the Royal Statistical Society Series B, 34, pages 187–220.

See Also

coxph, cvpl

Examples

require(survival)
set.seed(12345)
age <- rnorm(100, 50, 10)
stime <- rexp(100)
cens <- runif(100,.5,2)
sevent <- as.numeric(stime <= cens)
stime <- pmin(stime, cens)
##Cox model
coxm <- coxph(Surv(stime, sevent) ~ age)
##log partial likelihood of the null model
logpl(surv.time=stime, surv.event=sevent, beta=0, x=age)
##log partial likelihood of the Cox model
logpl(surv.time=stime, surv.event=sevent, beta=coxm$coefficients, x=age)
##equivalent to
coxm$loglik

[Package survcomp version 1.0 Index]