predictEvent {EventPredInCure}R Documentation

Predict event time for ongoing subjects with or without cured population.

Description

Utilizes pre-fitted time-to-event and time-to-dropout models to generate event and dropout times for ongoing subjects and new subjects. It also provides a prediction interval for the expected time to reach the target number of events.

Usage

predictEvent(
  df = NULL,
  target_d,
  newSubjects = NULL,
  event_fit,
  dropout_fit = NULL,
  fixedFollowup = FALSE,
  followupTime = 365,
  pilevel = 0.9,
  nyears = 4,
  nreps = 500,
  showEnrollment = TRUE,
  showEvent = TRUE,
  showDropout = FALSE,
  showOngoing = FALSE,
  by_treatment = FALSE,
  seed.num = NULL
)

Arguments

df

The subject-level enrollment and event data, including randdt, cutoffdt, time, event, and dropout. By default, it is set to NULL for event prediction at the design stage.

target_d

The target number of events to reach in the study.

newSubjects

The enrollment data for new subjects including draw and arrivalTime. By default, it is set to NULL, indicating the completion of subject enrollment.

event_fit

The pre-fitted event model used to generate predictions.

dropout_fit

The pre-fitted dropout model used to generate predictions. By default, it is set to NULL, indicating no dropout.

fixedFollowup

A Boolean variable indicating whether a fixed follow-up design is used. By default, it is set to FALSE for a variable follow-up design.

followupTime

The follow-up time for a fixed follow-up design, in days. By default, it is set to 365.

pilevel

The prediction interval level. By default, it is set to 0.90.

nyears

The number of years after the data cut for prediction. By default, it is set to 4.

nreps

The number of replications for simulation. By default, it is set to 500. If newSubjects is not NULL, the number of draws in newSubjects should be nreps.

showEnrollment

A Boolean variable to control whether or not to show the number of enrolled subjects. By default, it is set to TRUE.

showEvent

A Boolean variable to control whether or not to show the number of events. By default, it is set to TRUE.

showDropout

A Boolean variable to control whether or not to show the number of dropouts. By default, it is set to FALSE.

showOngoing

A Boolean variable to control whether or not to show the number of ongoing subjects. By default, it is set to FALSE.

by_treatment

A Boolean variable to control whether or not to predict event by treatment group. By default, it is set to FALSE.

seed.num

The number of the random seed. The default is NULL.

Details

To ensure successful event prediction at the design stage, it is important to provide the newSubjects data set.

To specify the event model used during the design-stage event prediction, the event_fit be a list with one element per treatment. For each treatment, the element should include w to specify the weight of the treatment in a randomization block, model to specify the event model (exponential, weibull, log-logistic, log-normal, or piecewise exponential, weibull with cured population,exponential with cured population,log-normal with cured population, log-logistic with cured population,piecewise exponential with cured population, exponential with cured population and delayed treatment,weibull with cured population and delayed treatment, log-normal with cured population and delayed treatment,log-logistic with cured population and delayed treatment), theta and vtheta to indicate the parameter values and the covariance matrix. For the piecewise exponential or piecewise exponential with cured population or piecewise exponential with cured population and delayed treatment event model, the list should also include piecewiseSurvivalTime to indicate the location of knots. It should be noted that the model averaging and spline options are not appropriate for use as prior.

To specify the dropout model used during the design stage event prediction, the dropout_fit should be a list with one element per treatment. For each treatment, the element should include w to specify the weight of the treatment in a randomization block, model to specify the dropout model (exponential, weibull, log-logistic, log-normal, or piecewise exponential), theta and vtheta to indicate the parameter values and the covariance matrix. For the piecewise exponential dropout model, the list should also include piecewiseDropoutTime to indicate the location of knots.

Following the commencement of the trial, we obtain the event model fit and the dropout model fit based on the observed data, denoted as event_fit and dropout_fit, respectively. These fitted models are subsequently utilized to generate event and dropout times for both ongoing and new subjects in the trial.

Value

A list of prediction results which includes important information such as the median, lower and upper percentiles for the estimated day and date to reach the target number of events, as well as simulated event data for both ongoing and new subjects. The data for the prediction plot is also included within this list.

References

Examples


fit1 <- list(model = "piecewise uniform",
             theta = -0.58, 
             vtheta=0, accrualTime =0)
fit2<-list()
fit2[[1]] <- list(model = "weibull with cured population and delayed treatment", 
                  theta = c(-2.2,0,6.5,0,1), 
                  vtheta = matrix(0,5,5))
fit2[[2]] <- list(model = "weibull with cured population and delayed treatment", 
                 theta = c(-2.2,0,6.5,46,0.65), 
                 vtheta = matrix(0,5,5))
                  
 enroll_pred <- predictEnrollment(df = NULL, target_n=200, enroll_fit = fit1,lags=46,
                                  pilevel=0.9, nyears=4, nreps=100,by_treatment=TRUE,
                                  ngroups=2, alloc=c(1,1), treatment_label=c('a','b'))

 event_pred <- predictEvent(df = NULL, target_d=60,
                            newSubjects = enroll_pred$newSubjects,
                            event_fit = fit2,dropout_fit = NULL,
                            pilevel=0.9, 
                            nyears=4, 
                            nreps=100,
                            by_treatment=TRUE)



[Package EventPredInCure version 1.0 Index]