Description Usage Arguments Examples
View source: R/loglik.pchsurv.R
Given time to event data, a set of cuts and a log-hazard value, compute the maximum likelihood function
1 | loglik.pchsurv(time, status, cuts, a, weights = NULL)
|
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. |
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.