f_dose_new_cpp {drugDemand}  R Documentation 
Dosing Date Imputation for New Patients
Description
Imputes the dosing dates for new patients and ongoing patients with no dosing records.
Usage
f_dose_new_cpp(
usubjid,
V,
C,
D,
model_k0,
theta_k0,
model_t0,
theta_t0,
model_t1,
theta_t1,
model_ki,
theta_ki,
model_ti,
theta_ti
)
Arguments
usubjid 
The unique subject ID. 
V 
Initialized to 0 and corresponds to the randomization visit. 
C 
The cutoff date relative to randomization. 
D 
The discontinuation date relative to randomization. 
model_k0 
The model for the number of skipped visits between randomization and the first drug dispensing visit. Options include "constant", "poisson", "zeroinflated poisson", and "negative binomial". 
theta_k0 
The model parameters for the number of skipped visits between randomization and the first drug dispensing visit. 
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", "loglogistic", and "lognormal". 
theta_t0 
The model parameters for the gap time between randomization and the first drug dispensing visit when there is no visit skipping. 
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". 
theta_t1 
The model parameters for the gap time between randomization and the first drug dispensing visit when there is visit skipping. 
model_ki 
The model for the number of skipped visits between two consecutive drug dispensing visits. Options include "constant", "poisson", "zeroinflated poisson", and "negative binomial". 
theta_ki 
The model parameters for the number of skipped visits between two consecutive drug dispensing visits. 
model_ti 
The model for the gap time between two consecutive drug dispensing visits. Options include "least squares" and "least absolute deviations". 
theta_ti 
The model parameters for the gap time between two consecutive drug dispensing visits. 
Value
A data frame with two variables:

usubjid
: The unique subject ID. 
day
: The dosing visit date relative to randomization.
Author(s)
Kaifeng Lu, kaifenglu@gmail.com
Examples
set.seed(529)
f_dose_new_cpp(
usubjid = "Z001", V = 0, C = 87, D = 985,
model_k0 = "zeroinflated poisson", theta_k0 = c(0.6, 1.1),
model_t0 = "loglogistic", theta_t0 = c(1.0, 0.7),
model_t1 = "least squares", theta_t1 = c(21.5, 1.9),
model_ki = "zeroinflated poisson", theta_ki = c(0.1, 0.4),
model_ti = "least squares", theta_ti = c(21, 2.3))