logpl: Function to compute the log partial likelihood of a Cox model

Description Usage Arguments Value Author(s) References See Also Examples

Description

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

Usage

1
logpl(pred, surv.time, surv.event, strata, na.rm = FALSE, verbose = FALSE)

Arguments

surv.time

vector of times to event occurrence

surv.event

vector of indicators for event occurrence

pred

linear predictors computed using the Cox model

strata

stratification variable

na.rm

TRUE if the missing values should be removed from the data, FALSE otherwise

verbose

verbosity of the function

Value

vector of 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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
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)
dd <- data.frame("stime"=stime, "sevent"=sevent, "age"=age)
##Cox model
coxm <- coxph(Surv(stime, sevent) ~ age, data=dd)
##log partial likelihood of the null model
logpl(pred=rep(0, nrow(dd)), surv.time=stime, surv.event=sevent)
##log partial likelihood of the Cox model
logpl(pred=predict(object=coxm, newdata=dd), surv.time=stime, surv.event=sevent)
##equivalent to
coxm$loglik

bhklab/survcomp documentation built on Dec. 26, 2021, 6:41 a.m.