compute_contrast_observations.RdCompute contrast observations for prediction plots
compute_contrast_observations(
data,
conc_col,
dv_col,
id_col = NULL,
ntime_col = NULL,
trt_col = NULL,
treatment_predictors,
control_predictors = NULL,
contrast_method = c("matched", "group")
)A data frame containing C-QT analysis dataset
An unquoted column name for drug concentration measurements
An unquoted column name for dQTC measurements
An unquoted column name for subject ID, used when control predictors is provided to compute delta delta dv
An unquoted column name for Nominal time data, used when control predictors is provided to compute delta delta dv
An unquoted column name for Treatment group data, used when control predictors is provided to compute delta delta dv
A list for predictions with model. Should contain a value for each predictor in the model.
An optional list for contrast predictions
A string specifying contrast method: "matched" for individual ID+time matching (crossover studies), "group" for group-wise subtraction (parallel studies)
a tibble with columns: group, conc, dv
data_proc <- preprocess(cqtkit_data_verapamil)
# Simple case: no control group
obs_data <- compute_contrast_observations(
data_proc,
CONC,
deltaQTCF,
treatment_predictors = list(TRTG = "Verapamil HCL")
)
obs_data
#> # A tibble: 643 × 3
#> group conc dv
#> <chr> <dbl> <dbl>
#> 1 Observations 0 -6.00
#> 2 Observations 0 -12.1
#> 3 Observations 0 -5.54
#> 4 Observations 0 -22.5
#> 5 Observations 0 1.33
#> 6 Observations 0 -6.58
#> 7 Observations 0 -12.4
#> 8 Observations 0 -11.1
#> 9 Observations 0 -7.66
#> 10 Observations 0 -2.73
#> # ℹ 633 more rows
# Matched contrast (crossover study)
contrast_data <- compute_contrast_observations(
data_proc,
CONC,
deltaQTCF,
ID,
NTLD,
TRTG,
treatment_predictors = list(TRTG = "Verapamil HCL"),
control_predictors = list(TRTG = "Placebo"),
contrast_method = "matched"
)
#> Warning: Observed data contained NA and are removed in plot
contrast_data
#> # A tibble: 313 × 3
#> group conc dv
#> <chr> <dbl> <dbl>
#> 1 Observations 180 1.57
#> 2 Observations 51.5 4.59
#> 3 Observations 46.1 6.69
#> 4 Observations 251 11.0
#> 5 Observations 72.6 -11.7
#> 6 Observations 201 1.36
#> 7 Observations 91.1 -3.85
#> 8 Observations 50 1.43
#> 9 Observations 368 8.08
#> 10 Observations 37.8 -0.910
#> # ℹ 303 more rows