Skip to content

compute_contrast_observations

Description

Compute contrast observations for prediction plots

Usage

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"
)
)

Arguments

NameDescription
dataa dataframe of QTc dataset
conc_colan unquoted column name of drug concentration measurements
dv_colan unquoted column name of dQTC measurements
id_colan unquoted column name of ID data, used when control predictors is provided to compute delta delta dv
ntime_colan unquoted column name of Nominal time data, used when control predictors is provided to compute delta delta dv
trt_colan unquoted column name of Treatment group data, used when control predictors is provided to compute delta delta dv
treatment_predictorsa list for predictions with model. Should contain a value for each predictor in the model.
control_predictorsan optional list for contrast predictions
contrast_methoda string specifying contrast method: “matched” for individual ID+time matching (crossover studies), “group” for group-wise subtraction (parallel studies)

Returns

a tibble with columns: group, conc, dv

Examples

data <- preprocess(data)
# Simple case: no control group
obs_data <- compute_contrast_observations(
data,
CONC,
deltaQTCF,
treatment_predictors = list(TRTG = "Verapamil HCL")
)
obs_data
# Matched contrast (crossover study)
contrast_data <- compute_contrast_observations(
data,
CONC,
deltaQTCF,
ID,
NTLD,
TRTG,
treatment_predictors = list(TRTG = "Verapamil HCL"),
control_predictors = list(TRTG = "Placebo"),
contrast_method = "matched"
)
contrast_data
compute_contrast_observations.R
# A tibble: 643 × 3
group conc dv
<chr> <dbl> <dbl>
1 Observations 0 -6.01
2 Observations 0 -12.0
3 Observations 0 -5.45
4 Observations 0 -22.5
5 Observations 0 1.29
6 Observations 0 -6.54
7 Observations 0 -12.5
8 Observations 0 -11.0
9 Observations 0 -7.72
10 Observations 0 -2.76
# ℹ 633 more rows
# A tibble: 313 × 3
group conc dv
<chr> <dbl> <dbl>
1 Observations 180 1.57
2 Observations 51.5 4.52
3 Observations 46.1 6.96
4 Observations 251 11.0
5 Observations 72.6 -10.5
6 Observations 201 1.58
7 Observations 91.1 -3.82
8 Observations 50 1.46
9 Observations 368 8.09
10 Observations 37.8 -0.864
# ℹ 303 more rows