Learn R Programming

drugDemand (version 0.1.3)

f_dispensing_models: 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
)

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.

Arguments

vf

A data frame for subject-level drug dispensing data, including the following variables: drug, drug_name, kit, kit_name, usubjid, treatment, treatment_description, arrivalTime, time, event, dropout, day, dose, cum_dose, and row_id.

dosing_schedule_df

A data frame providing dosing schedule information. It contains the following variables: kit, target_days, target_dose, and max_cycles.

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 TRUE.

Author

Kaifeng Lu, kaifenglu@gmail.com

See Also

f_fit_t0, f_fit_ki, f_fit_ti, f_fit_di

Examples

Run this code
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

Run the code above in your browser using DataLab