Learn R Programming

eventPred (version 0.2.7)

fitEnrollment: Fit enrollment model

Description

Fits a specified enrollment model to the enrollment data.

Usage

fitEnrollment(
  df,
  enroll_model = "b-spline",
  nknots = 0,
  accrualTime = 0,
  showplot = TRUE
)

Value

A list of results from the model fit including key information such as the enrollment model, model, the estimated model parameters, theta, the covariance matrix, vtheta, the Akaike Information Criterion, aic, and the Bayesian Information Criterion, bic, as well as the design matrix x for the B-spline enrollment model, and accrualTime for the piecewise Poisson enrollment model.

The fitted enrollment curve is also returned.

Arguments

df

The subject-level enrollment data, including trialsdt, randdt and cutoffdt.

enroll_model

The enrollment model which can be specified as "Poisson", "Time-decay", "B-spline", or "Piecewise Poisson". By default, it is set to "B-spline".

nknots

The number of inner knots for the B-spline enrollment model. By default, it is set to 0.

accrualTime

The accrual time intervals for the piecewise Poisson model. Must start with 0, e.g., c(0, 30) breaks the time axis into 2 accrual intervals: [0, 30) and [30, Inf). By default, it is set to 0.

showplot

A Boolean variable to control whether or not to show the fitted enrollment curve. By default, it is set to TRUE.

Author

Kaifeng Lu, kaifenglu@gmail.com

Details

For the time-decay model, the mean function is $$\mu(t) = (\mu/\delta)(t - (1/\delta)(1 - \exp(-\delta t)))$$ and the rate function is $$\lambda(t) = (\mu/\delta)(1 - \exp(-\delta t)).$$ For the B-spline model, the daily enrollment rate is \(\lambda(t) = \exp(B(t)' \theta)\), where \(B(t)\) represents the B-spline basis functions.

References

Xiaoxi Zhang and Qi Long. Stochastic modeling and prediction for accrual in clinical trials. Stat in Med. 2010; 29:649-658.

Examples

Run this code

enroll_fit <- fitEnrollment(
  df = interimData1, enroll_model = "b-spline",
  nknots = 1)

Run the code above in your browser using DataLab