View source: R/f_drug_demand.R
f_drug_demand | R Documentation |
Obtains drug demand forecasting via modeling and simulation.
f_drug_demand(
df = NULL,
newEvents = NULL,
visitview = NULL,
kit_description_df = NULL,
treatment_by_drug_df = NULL,
dosing_schedule_df = NULL,
model_k0 = "negative binomial",
model_t0 = "log-logistic",
model_t1 = "least squares",
model_ki = "negative binomial",
model_ti = "least absolute deviations",
model_di = "linear mixed-effects model",
pilevel = 0.95,
nyears = 1,
ncores_max = 10,
pred_pp_only = FALSE,
showplot = TRUE
)
df |
A data frame for subject-level enrollment and event data,
including the following variables:
|
newEvents |
A data frame containing the imputed event data
for both ongoing and new patients, typically obtained from
the output of the |
visitview |
A data frame containing the observed drug dispensing
data, including the following variables:
|
kit_description_df |
A data frame indicating the
drug and kit descriptions, including the following variables:
|
treatment_by_drug_df |
A data frame indicating the treatments
associated with each drug, including the following variables:
|
dosing_schedule_df |
A data frame providing dosing schedule
information. It contains the following variables:
|
model_k0 |
The model for the number of skipped visits between randomization and the first drug dispensing visit. Options include "constant", "poisson", "zero-inflated poisson", and "negative binomial". |
model_t0 |
The model for the gap time between randomization and the first drug dispensing visit when there is no visit skipping. Options include "constant", "exponential", "weibull", "log-logistic", and "log-normal". |
model_t1 |
The model for the gap time between randomization and the first drug dispensing visit when there is visit skipping. Options include "least squares" and "least absolute deviations". |
model_ki |
The model for the number of skipped visits between two consecutive drug dispensing visits. Options include "constant", "poisson", "zero-inflated poisson", and "negative binomial". |
model_ti |
The model for the gap time between two consecutive drug dispensing visits. Options include "least squares" and "least absolute deviations". |
model_di |
The model for the dispensed doses at drug dispensing visits. Options include "constant", "linear model", and "linear mixed-effects model". |
pilevel |
The prediction interval level. |
nyears |
The number of years after the data cut for prediction. |
ncores_max |
The maximum number of cores to use for parallel
computing. The actual number of cores used is the minimum of
|
pred_pp_only |
A Boolean variable that controls whether or not to make protocol-based predictions only. |
showplot |
A Boolean variable that controls whether or not to
show the drug dispensing model fit and drug demand prediction
plots. It defaults to |
For design-stage drug demand forecasting, a list with the following components:
kit_description_df
: A data frame indicating the
drug and kit descriptions, including the following variables:
drug
, drug_name
, kit
, and kit_name
.
treatment_by_drug_df
: A data frame indicating the treatments
associated with each drug, including the following variables:
treatment
and drug
.
dosing_schedule_df
: A data frame providing dosing schedule
information. It contains the following variables:
kit
, target_days
, target_dose
, and
max_cycles
.
dosing_pred_df
: A data frame for dosing summary by kit type
and time point per protocol. It includes the following variables:
kit
, kit_name
, t
, n
, pilevel
,
lower
, upper
, mean
, var
, and
parameter
.
dosing_pred_plot
: A plot object for dosing prediction.
For analysis-stage drug demand forecasting, a list with the following components:
trialsdt
: The trial start date.
cutoffdt
: The cutoff date.
dosing_summary_t0
: A data frame for the cumulative doses
dispensed before the cutoff date. It contains the following
variables:
kit
, kit_name
, and cum_dose_t0
.
cum_dispense_plot
: The step plot for the cumulative doses
dispensed for each kit type.
bar_t0_plot
: The bar chart for the time between
randomization and the first drug dispensing visit.
bar_ti_plot
: The bar chart for the gap time between two
consecutive drug dispensing visits.
bar_di_plot
: The bar chart for the doses dispensed at drug
dispensing visits.
common_time_model
: A Boolean variable that indicates
whether a common time model is used for drug dispensing visits.
k0_fit
: The model fit for the number of skipped
visits between randomization and the first drug dispensing visit.
t0_fit
: The model fit for the gap time between
randomization and the first drug dispensing visit when there is
no visit skipping.
t1_fit
: The model fit for the gap time between
randomization and the first drug dispensing visit when there is
visit skipping.
ki_fit
: The model fit for the number of skipped
visits between two consecutive drug dispensing visits.
ti_fit
: The model fit for the gap time between two
consecutive drug dispensing visits.
di_fit
: The model fit for the dispensed doses at drug
dispensing visits.
kit_description_df
: A data frame indicating the
drug and kit descriptions, including the following variables:
drug
, drug_name
, kit
, and kit_name
.
treatment_by_drug_df
: A data frame indicating the treatments
associated with each drug, including the following variables:
treatment
and drug
.
dosing_schedule_df
: A data frame providing dosing schedule
information. It contains the following variables:
kit
, target_days
, target_dose
, and
max_cycles
.
dosing_subject_df
: A data frame for the observed and imputed
subject-level dosing records for the first iteration. It includes
the following variables:
drug
, drug_name
, kit
, kit_name
,
usubjid
, treatment
, treatment_description
,
arrivalTime
, time
, day
, dose
,
cum_dose
, row_id
, subject_type
, imputed
,
trialsdt
, cutoffdt
, randdt
, adt
,
and date
.
dosing_pred_df
: A data frame for dosing summary by kit type
and time point. It includes the following variables:
kit
, kit_name
, t
, n
, pilevel
,
lower
, upper
, mean
, var
, date
,
and parameter
.
dosing_pred_plot
: A plot object for dosing prediction.
Kaifeng Lu, kaifenglu@gmail.com
f_fit_t0
, f_fit_ki
,
f_fit_ti
, f_fit_di
set.seed(529)
pred <- eventPred::getPrediction(
df = df2,
to_predict = "event only",
target_d = 250,
event_model = "log-logistic",
dropout_model = "none",
pilevel = 0.95,
nyears = 1,
nreps = 200,
showplot = FALSE,
by_treatment = TRUE)
drug_demand <- f_drug_demand(
df = df2,
newEvents = pred$event_pred$newEvents,
visitview = visitview2,
dosing_schedule_df = dosing_schedule_df,
model_k0 = "zero-inflated poisson",
model_t0 = "log-logistic",
model_t1 = "least squares",
model_ki = "zero-inflated poisson",
model_ti = "least squares",
model_di = "linear mixed-effects model",
pilevel = 0.95,
nyears = 1,
ncores_max = 2,
showplot = FALSE)
drug_demand$dosing_pred_plot
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.