make_ader.RdJoins subject-level exposure metrics to a response endpoint and derives the exposure quantile grouping that an exposure-response summary or plot is almost always stratified by.
make_ader(
exposure,
response,
by = "USUBJID",
exposure_var = "AUCLST",
response_var = "AVAL",
n_groups = 4
)Subject-level exposure metrics, one record per by group —
typically the output of derive_exposure_metrics(), filtered to a single
analyte.
Response endpoint data, one record per by group.
Character vector of join keys. Both inputs must be unique on it.
Name of the exposure metric column in exposure to
group on.
Name of the response column in response.
Number of exposure quantile groups.
An eradam_ader object: a tibble::tibble with one record per by
group.
Groups are cut at the sample quantiles of exposure_var
(stats::quantile(), default type 7) with the lowest value included in the
first group. EXPQN is the group number, 1 being the lowest exposure, and
EXPQ is a label carrying the range of the group, for example
"Q1 (6619-14800)", so a figure legend is self-describing. EXPQ is an
ordered factor, so it plots and tabulates in exposure order rather than
alphabetically.
There is no CDISC structure for an exposure-response dataset, so EXPPARM,
EXPVAL, EXPQN and EXPQ are names chosen by this package. USUBJID,
PARAMCD, PARAM and AVAL are standard ADaM names and keep their standard
meanings, applied to the response endpoint.
| Variable | Meaning | Source |
USUBJID | Unique subject identifier (or the by variables supplied) | exposure / response |
EXPANLT | Analyte the exposure metric was derived for | exposure column PARAMCD, renamed |
EXPPARM | Name of the exposure metric used | Argument exposure_var |
EXPVAL | Value of the exposure metric | exposure |
EXPQN | Exposure quantile group number (1 = lowest exposure) | Derived |
EXPQ | Exposure quantile group label, including the range of the group | Derived |
PARAMCD | Response parameter code | response (kept when present) |
PARAM | Response parameter description | response (kept when present) |
AVAL | Response value | response (argument response_var) |
<other> | Any remaining columns of exposure and response | exposure / response |
pc <- eradam_example("pc")
ex <- eradam_example("ex")
resp <- eradam_example("resp")
expo <- derive_exposure_metrics(pc[pc$PARAMCD == "DRUGX", ], ex)
ader <- make_ader(expo, resp)
ader
#>
#> ── eradam exposure-response dataset ────────────────────────────────────────────
#> ℹ 24 subject(s) | exposure: AUCLST | response: AVAL
#> ℹ Q1 (6620-11800): n = 6, mean response = -17.89
#> ℹ Q2 (11800-22300): n = 6, mean response = -27.94
#> ℹ Q3 (22300-32000): n = 6, mean response = -32.54
#> ℹ Q4 (32000-52700): n = 6, mean response = -41.66
#> # A tibble: 24 × 22
#> USUBJID EXPANLT EXPPARM EXPVAL EXPQN EXPQ PARAMCD PARAM AVAL NOBS TFIRST
#> <chr> <chr> <chr> <dbl> <int> <ord> <chr> <chr> <dbl> <int> <dbl>
#> 1 ERADAM01… DRUGX AUCLST 6619. 1 Q1 (… PCHGBIO Perc… -21.3 11 0.58
#> 2 ERADAM01… DRUGX AUCLST 11468. 1 Q1 (… PCHGBIO Perc… -19.1 11 0.499
#> 3 ERADAM01… DRUGX AUCLST 11919. 2 Q2 (… PCHGBIO Perc… -26.4 11 0.504
#> 4 ERADAM01… DRUGX AUCLST 10329. 1 Q1 (… PCHGBIO Perc… -18.8 11 0.506
#> 5 ERADAM01… DRUGX AUCLST 6868. 1 Q1 (… PCHGBIO Perc… -10.9 11 0.538
#> 6 ERADAM01… DRUGX AUCLST 6645. 1 Q1 (… PCHGBIO Perc… -18.7 11 0.494
#> 7 ERADAM01… DRUGX AUCLST 8033. 1 Q1 (… PCHGBIO Perc… -18.5 11 0.509
#> 8 ERADAM01… DRUGX AUCLST 12978. 2 Q2 (… PCHGBIO Perc… -30.4 11 0.521
#> 9 ERADAM01… DRUGX AUCLST 19621. 2 Q2 (… PCHGBIO Perc… -34 11 0.547
#> 10 ERADAM01… DRUGX AUCLST 30823. 3 Q3 (… PCHGBIO Perc… -32.7 11 0.48
#> # ℹ 14 more rows
#> # ℹ 11 more variables: TLAST <dbl>, CMAX <dbl>, TMAX <dbl>, CMIN <dbl>,
#> # CTROUGH <dbl>, AUCLST <dbl>, AUCMTH <chr>, DOSE <dbl>, AUCLSTD <dbl>,
#> # STUDYID <chr>, AVALU <chr>
# mean response by exposure quartile
tapply(ader$AVAL, ader$EXPQ, mean)
#> Q1 (6620-11800) Q2 (11800-22300) Q3 (22300-32000) Q4 (32000-52700)
#> -17.89000 -27.94167 -32.53667 -41.66333
# tertiles of maximum concentration instead
make_ader(expo, resp, exposure_var = "CMAX", n_groups = 3)
#>
#> ── eradam exposure-response dataset ────────────────────────────────────────────
#> ℹ 24 subject(s) | exposure: CMAX | response: AVAL
#> ℹ Q1 (278-723): n = 8, mean response = -20.52
#> ℹ Q2 (723-1170): n = 8, mean response = -30.57
#> ℹ Q3 (1170-2280): n = 8, mean response = -38.94
#> # A tibble: 24 × 22
#> USUBJID EXPANLT EXPPARM EXPVAL EXPQN EXPQ PARAMCD PARAM AVAL NOBS TFIRST
#> <chr> <chr> <chr> <dbl> <int> <ord> <chr> <chr> <dbl> <int> <dbl>
#> 1 ERADAM01… DRUGX CMAX 378. 1 Q1 (… PCHGBIO Perc… -21.3 11 0.58
#> 2 ERADAM01… DRUGX CMAX 491. 1 Q1 (… PCHGBIO Perc… -19.1 11 0.499
#> 3 ERADAM01… DRUGX CMAX 448. 1 Q1 (… PCHGBIO Perc… -26.4 11 0.504
#> 4 ERADAM01… DRUGX CMAX 430. 1 Q1 (… PCHGBIO Perc… -18.8 11 0.506
#> 5 ERADAM01… DRUGX CMAX 329. 1 Q1 (… PCHGBIO Perc… -10.9 11 0.538
#> 6 ERADAM01… DRUGX CMAX 278. 1 Q1 (… PCHGBIO Perc… -18.7 11 0.494
#> 7 ERADAM01… DRUGX CMAX 362. 1 Q1 (… PCHGBIO Perc… -18.5 11 0.509
#> 8 ERADAM01… DRUGX CMAX 615. 1 Q1 (… PCHGBIO Perc… -30.4 11 0.521
#> 9 ERADAM01… DRUGX CMAX 849. 2 Q2 (… PCHGBIO Perc… -34 11 0.547
#> 10 ERADAM01… DRUGX CMAX 1185. 3 Q3 (… PCHGBIO Perc… -32.7 11 0.48
#> # ℹ 14 more rows
#> # ℹ 11 more variables: TLAST <dbl>, CMAX <dbl>, TMAX <dbl>, CMIN <dbl>,
#> # CTROUGH <dbl>, AUCLST <dbl>, AUCMTH <chr>, DOSE <dbl>, AUCLSTD <dbl>,
#> # STUDYID <chr>, AVALU <chr>