logpl {survcomp} | R Documentation |
The function computes the log partial likelihood of a set of coefficients given some survival data.
logpl(surv.time, surv.event, beta, x, strata.cox = NULL, na.rm = FALSE, verbose = FALSE)
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 |
vectorof two elements: logpl
and event
for the estimation of the log partial likelihood and the number of events, respectively
Benjamin Haibe-Kains
Cox, D. R. (1972) "Regression Models and Life Tables", Journal of the Royal Statistical Society Series B, 34, pages 187–220.
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