# NOT RUN {
library(survival)
n=100
set.seed(10)
# Generate the data
error=rnorm(n)
tr=exp(rnorm(n)+error+0.5)
tp=exp(rnorm(n)+error)
tr[tp<tr]=Inf
tc=runif(n, 3, 8.5)
t2response=pmin(tr, tc)
delta_response=1*(tr<tc)
t2progression=pmin(tp, tc)
delta_progression=1*(tp<tc)
# Estimate the mean duration of response (point estimator and its standard error)
fit=mduration(t2PROGRESSION=t2progression,
STATUS_PROGRESSION=delta_progression,
t2RESPONSE=t2response,
STATUS_RESPONSE=delta_response,
time.max=8)
fit
# }
Run the code above in your browser using DataLab