| f_dispensing_models {drugDemand} | R Documentation | 
Drug Dispensing Model Fitting
Description
Fits drug dispensing models to the observed drug dispensing data.
Usage
f_dispensing_models(
  vf,
  dosing_schedule_df,
  model_k0,
  model_t0,
  model_t1,
  model_ki,
  model_ti,
  model_di,
  nreps,
  showplot = TRUE
)
Arguments
| vf | A data frame for subject-level drug dispensing data,
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". | 
| nreps | The number of simulations for drawing posterior model parameters. | 
| showplot | A Boolean variable that controls whether or not to
show the model fit plot. It defaults to  | 
Value
A list with the following components:
-  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.
Author(s)
Kaifeng Lu, kaifenglu@gmail.com
See Also
f_fit_t0, f_fit_ki,
f_fit_ti, f_fit_di
Examples
library(dplyr)
observed <- f_dose_observed(df2, visitview2, showplot = FALSE)
dispensing_models <- f_dispensing_models(
  observed$vf, 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",
  nreps = 200, showplot = FALSE)
dispensing_models$ki_fit$fit_plot