---
title: "Event Prediction before Enrollment Completion"
author: "Kaifeng Lu"
date: "2024-01-20"
output: rmarkdown::html_vignette
vignette: >
  %\VignetteIndexEntry{Event Prediction before Enrollment Completion}
  %\VignetteEngine{knitr::rmarkdown}
  \usepackage[utf8]{inputenc}
---

```{r, include = FALSE}
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)
```

```{r setup}
library(eventPred)
```

We analyzed interim enrollment and event data from the interimData1 dataset within the eventPred package. As of the cutoff date of March 1, 2019, 224 patients had been enrolled (with a target of 300), and 42 patients had experienced the event of interest (with a target of 200 events).

A time-decay model was used to predict future enrollment patterns. A Weibull distribution was employed to model the time to event. Dropout modeling was not performed due to the limited number of dropouts (only one).

```{r}
set.seed(2000)

pred <- getPrediction(
  df = interimData1,
  to_predict = "enrollment and event",
  target_n = 300,
  target_d = 200,
  enroll_model = "time-decay",
  event_model = "weibull",
  dropout_model = "none",
  pilevel = 0.90, 
  nreps = 500)
```

The median predicted date to reach 200 events is June 13, 2021. The 90% prediction interval for event completion is wide, ranging from June 18, 2020 to December 18, 2022, indicating uncertainty in the prediction. The wide prediction interval is primarily attributed to the limited number of events observed thus far (42 out of 200 target events). More events are needed to refine the prediction and narrow the prediction interval.

