Learn R Programming

reReg (version 1.3.0)

simSC: Function to generate simulated recurrent event data

Description

The function simSC() generates simulated recurrent event data from either a Cox-type model, an accelerated mean model, an accelerated rate model, or a scale-change model.

Usage

simSC(
  n,
  a1 = a2,
  b1 = b2,
  a2 = a1,
  b2 = b1,
  type = "cox",
  zVar = 0.25,
  tau = 60,
  summary = FALSE
)

Arguments

n

number of observation.

a1, a2, b1, b2

are numeric vectors of length 2. These correspond to the \(\alpha\), \(\beta\), \(\eta\), and \(\theta\) in the joint model. See Details

type

is a character string specifying the underlying model. The rate function type and the hazard function type are separated by a vertical bar "|", with the rate function on the left. For example, type = "cox|am" generates the recurrent process from a Cox model and the terminal event from an accelerated mean model. Setting type = "cox" gives type = "cox|cox".

zVar

a numeric variable specifying the variance of the fraility variable,\(Z\), when zVar > 0. When zVar = 0, \(Z\) is set to a fixed constant 1. The default value is 0.25.

tau

a numeric value specifying the maximum observation time.

summary

a logical value indicating whether a brief data summary will be printed.

Details

The function simSC() generates simulated recurrent event data over the interval \((0, \tau)\) based on the specification of the recurrent process and the terminal events. Specifically, the rate function, \(\lambda(t)\), of the recurrent process can be specified as one of the following model: $$\lambda(t) = Z \lambda_0(te^{X^\top\alpha}) e^{X^\top\beta}, h(t) = Z h_0(te^{X^\top\eta})e^{X^\top\theta}, $$ where \(\lambda_0(t)\) is the baseline rate function, \(h_0(t)\) is the baseline hazard function, \(X\) is a \(n\) by \(p\) covariate matrix and \(\alpha\), \(Z\) is an unobserved shared frailty variable, and \((\alpha, \eta)\) and \((\beta, \theta)\) correspond to the shape and size parameters of the rate function and the hazard function, respectively.

For all scenarios, two covariates are considered; \(X = (X_1, X_2)\), where \(X_1\) follows a Bernoulli distribution with probability 0.5 and \(X_2\) follows a standard normal distribution. The censoring time could be either independent (given covariates) or informative. The simulated data is used for illustration. An informative censoring time, \(C\), is generated separately from an exponential distribution with a rate parameter of 1 / 60 if \(X_1\) is 1, or \(Z^2 / 30\) if \(X_1\) is 0. The observed recurrent events is then observed up to the minimum of \(C\), terminal event, and \(\tau\). Lastly, we assume the baseline functions $$\lambda_0(t) = \frac{2}{1 + t}, h_0(t) = \frac{1}{8(1 + t)}.$$

See Also

reReg

Examples

Run this code
# NOT RUN {
set.seed(123)
simSC(100, c(-1, 1), c(-1, 1), summary = TRUE)
# }

Run the code above in your browser using DataLab