sim.rec: Simulate recurrent event data

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/AFTsimrecurrent.R

Description

Simulate recurrent event data for fixed covariates

Usage

1
sim.rec(surv.formula, surv.par, surv.model, Data, origin, end.time)

Arguments

surv.formula

a one-sided formula of the form ~ z1 + z2 + ... + zp, where z1, z2, ..., zp are baseline covariates for the time-to-event process.

surv.par

a list of the form list(beta = a vector, logrho = a scalar, logkappa = a scalar) for the time-to-event model parameters, where beta is the vector of regression coefficients for the baseline covariates as specified in surv.formula (without an intercept), logrho is the log of the rate parameter of the time-to-event distribution (Weibull or log-logistic), and logkappa is the log of the shape parameter of the time-to-event distribution (Weibull or log-logistic). Note that surv.par must be a named list as above. See survreg.fit for parameterizations of the time-to-event distributions.

surv.model

the AFT model to be used to describe the recurrent event process. Available options are "weibull" and "llogistic" for Weibull and log-logistic distributions, respectively.

Data

a data frame containing the covariates z1, z2, ..., zp for the time-to-event model. For n subjects, it must must have n rows.

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).

Details

Simulate recurrent event data. See Section 2.4 of Cook and Lawless.

Value

a data frame containing id, start, stop, status and covariates.

Author(s)

Shahedul Khan <khan@math.usask.ca>

References

Cook RJ and Lawless J, The statistical analysis of recurrent events, Springer, 2007.

See Also

survreg.aft

Examples

 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")

sa4khan/AFTjmr documentation built on March 12, 2020, 1:24 a.m.