f_ongoing_new: Observed Dosing for Ongoing and New Subjects

View source: R/f_ongoing_new.R

f_ongoing_newR Documentation

Observed Dosing for Ongoing and New Subjects

Description

Prepares the dosing data sets to impute for ongoing and new subjects.

Usage

f_ongoing_new(newEvents, kit_description_df, treatment_by_drug_df, vf)

Arguments

newEvents

A data frame containing the imputed event data for both ongoing and new patients, typically obtained from the output of the getPrediction function of the eventPred package. It contains the following variables: draw, usubjid, arrivalTime, treatment, treatment_description, time, event, dropout, and totalTime.

kit_description_df

A data frame indicating the drug and kit descriptions, including the following variables: drug, drug_name, kit, and kit_name. It must be specified at the design stage. It will be replaced with the observed information at the analysis stage.

treatment_by_drug_df

A data frame indicating the treatments associated with each drug, including the following variables: treatment and drug.

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.

Value

A list with the following components:

  • vf_ongoing: A data frame for the observed drug dispensing data for ongoing patients with drug dispensing records. It includes the following variables: draw, kit, kit_name, usubjid, day, dose, arrivalTime, treatment, treatment_description, time, and totalTime.

  • vf_new: A data frame for the randomization date for new patients and ongoing patients with no drug dispensing records. It includes the following variables: draw, kit, kit_name, usubjid, arrivalTime, treatment, treatment_description, time, and totalTime.

Author(s)

Kaifeng Lu, kaifenglu@gmail.com

Examples



set.seed(2000)

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)

observed <- f_dose_observed(df = df2, visitview = visitview2)

vf_ongoing_new <- f_ongoing_new(
  pred$event_pred$newEvents,
  observed$kit_description_df,
  observed$treatment_by_drug_df,
  observed$vf)

head(vf_ongoing_new$vf_ongoing)
head(vf_ongoing_new$vf_new)



drugDemand documentation built on May 29, 2024, 8:43 a.m.