pchsurv: Estimated survival function from the piecewise constant...

Description Usage Arguments Details Value See Also Examples

View source: R/pchsurv.R

Description

Given time to event data and a set of cuts return the survival estimator from maximum likelihood estimation in the piecewise constant hazard model

Usage

1
2
pchsurv(time, status, cuts, seqtime = NULL, CI = TRUE,
  alphaCI = 0.05)

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.

seqtime

a time sequence.

CI

should the confidence intervals be computed? Default to TRUE.

alphaCI

the value of alpha for 1-alpha confidence intervals. Default to 0.05.

Details

The survival estimator is computed from the maximum likelihood estimator in the piecewise constant hazard model. It is computed for each value of seqtime.

Value

surv the estimated survival function
CIleft the left confidence intervals of the survival function
CIright the right confidence intervals of the survival function

See Also

Other pchsurv functions: arpchsurv, bootpchsurv, mlepchsurv, rsurv

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
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
seqtime=seq(0,100,by=10)
result=pchsurv(time,delta,cuts,seqtime)
result
plot(result,CI=TRUE)

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