loglik.pchsurv: Likelihood function of a piecewise constant hazard model

Description Usage Arguments Examples

View source: R/loglik.pchsurv.R

Description

Given time to event data, a set of cuts and a log-hazard value, compute the maximum likelihood function

Usage

1
loglik.pchsurv(time, status, cuts, a, weights = NULL)

Arguments

time

the observed time data.

status

status of the time data. TRUE for true time and FALSE for censored time.

cuts

a sequence of cuts. Default to NULL which corresponds to the exponential model.

a

sequence of log-hazard values. Should be of length equal to length(cuts)+1.

weights

an optional weight sequence. Default to NULL.

Examples

1
2
3
4
5
6
7
8
9
n=400
cuts=c(20,40,50,70)
alpha=c(0,0.05,0.1,0.2,0.4)/10
time=rsurv(n,cuts,alpha) #generate true data from the pch model
censoring=runif(n,min=70,max=90)
time=pmin(time,censoring) #observed times
delta=time<censoring #gives 62% of observed data on average
result=mlepchsurv(time,delta,cuts)
loglik.pchsurv(time,delta,cuts,result$a)

obouaziz/pchsurv documentation built on Sept. 7, 2020, 11:03 a.m.