Description Usage Arguments Details Value Author(s) References See Also Examples
View source: R/AFTsimrecurrent.R
Simulate recurrent event data for fixed covariates
1 | sim.rec(surv.formula, surv.par, surv.model, Data, origin, end.time)
|
surv.formula |
a one-sided formula of the form |
surv.par |
a list of the form |
surv.model |
the AFT model to be used to describe the recurrent event process. Available options are
|
Data |
a data frame containing the covariates |
origin |
the time origin (an n x 1 vector for n subjects; typically, a vector of zeros). |
end.time |
the end of follow-up time (an n x 1 vector for n subjects). |
Simulate recurrent event data. See Section 2.4 of Cook and Lawless.
a data frame containing id
, start
, stop
, status
and covariates.
Shahedul Khan <khan@math.usask.ca>
Cook RJ and Lawless J, The statistical analysis of recurrent events, Springer, 2007.
1 2 3 4 5 6 7 8 9 10 11 | n<-100 # number of subjects
Data<-data.frame(z1=rnorm(n),z2=rbinom(n,1,0.5))
origin<-rep(0,n)
end.time<-runif(n,3,3.5)
surv.par<-list(beta=c(0.5,-0.5),logrho=log(0.25),logkappa=log(2))
sim.ll<-sim.rec(surv.formula=~z1+z2,surv.par=surv.par,surv.model="llogistic",
Data=Data,origin=origin,end.time=end.time)
survreg.aft(Formula=c(start,stop,status)~z1+z2,Data=sim.ll,model="llogistic")
sim.w<-sim.rec(surv.formula=~z1+z2,surv.par=surv.par,surv.model="weibull",
Data=Data,origin=origin,end.time=end.time)
survreg.aft(Formula=c(start,stop,status)~z1+z2,Data=sim.w,model="weibull")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.