
Adds a Parameter for Clinical Benefit
Source:R/derive_param_clinbenefit.R
derive_param_clinbenefit.RdAdds a parameter for clinical benefit/disease control
Usage
derive_param_clinbenefit(
dataset,
dataset_adsl,
filter_source,
source_resp,
source_pd = NULL,
source_datasets,
reference_date,
ref_start_window,
aval_fun = yn_to_numeric,
clinben_vals = c("CR", "PR", "SD", "NON-CR/NON-PD"),
set_values_to,
subject_keys = get_admiral_option("subject_keys")
)Arguments
- dataset
Input dataset. This is the dataset to which the clinical benefit rate parameter will be added.
The variables
PARAMCD,AVALC,ADT, and those specified by thesubject_keysparameter and thereference_dateparameter are expected.After applying
filter_sourceand/orsource_pdthe variableADTand the variables specified bysubject_keysmust be a unique key of the dataset.- dataset_adsl
ADSL input dataset.
The variables specified for
subject_keysis expected. For each subject of the specified dataset a new observation is added to the input dataset. Variables indataset_adslthat also appear indatasetwill be populated with the appropriate subject-specific value for these new observations.- filter_source
Filter condition in
datasetthat represents records for overall disease response assessment for a subject at a given timepoint, e.g.PARAMCD == "OVR"orPARAMCD == "OVRLRESP".- source_resp
A
date_sourceobject specifying the dataset, date variable, and filter condition used to identify response status.- source_pd
A
date_sourceobject specifying the dataset, date variable, and filter condition used to identify disease progression.- source_datasets
A named list of data sets is expected.
The list must contain the names provided by the
dataset_namefield of thedate_source()objects specified forsource_pdandsource_resp.- reference_date
Name of variable representing the index date for
ref_start_window. A variable providing a date. An unquoted symbol is expected.- ref_start_window
Integer representing number of days from
reference_datethat must elapse before an evaluable non-PD assessment counts toward determining clinical benefit.- aval_fun
Function to map character analysis value (
AVALC) to numeric analysis value (AVAL)The (first) argument of the function must expect a character vector and the function must return a numeric vector.
- clinben_vals
A vector of response values to be considered when determining clinical benefit.
- set_values_to
A named list returned by
vars()containing new variables and their static value to be populated for the clinical benefit rate parameter records, e.g.vars(PARAMCD = "CBR", PARAM = "Clinical Benefit Rate").- subject_keys
A named list returned by
vars()containing variables used to uniquely identify subjects.
Details
Clinical benefit/disease control is first identified by looking for subjects
having response status, and then derived for subjects that have at least one
evaluable non-PD response assessment prior to first PD (Progressive Disease)
(i.e., responses inclusive of CR, PR, SD, and NON-CR/NON-PD) and after a specified
amount of time from a reference date (ref_start_window).
Note: The user input values they wish to include when determining
clinical benefit using the argument clinben_vals. The default values for this are
CR, PR, SD, and NON-CR/NON-PD, as listed above. In the below example,
eligible values be limited to CR and PR.
Example: clinben_vals <- c("CR", "PR")
The input dataset (
dataset) is restricted to the observations matchingfilter_sourceand to observations before or at the date specified bysource_pd.This dataset is further restricted to include user-generated response assessments from
clinben_valsor include response assessments ofCR,PR,SD, andNON-CR/NON-PD, exclude missing response assessments, and exclude those less thanref_start_windowafterreference_date. The earliest assessment byADTis then selected.The dataset identified by
datasetinsource_respis restricted according to itsfilterargument. The variable corresponding to thedateparameter ofsource_respis considered together withADTfrom the previous step.For the observations being added to
dataset,ADTis set to the earlier of the first assessment date representing an evaluable non-PD assessment prior to first PD, or the date representing the start of response.For the observations being added to
dataset,AVALCis set toYfor those subjects in thedatasetmeeting the criteria for clinical benefit aboveNfor subjects not meeting the clinical benefit criteria indatasetor the dataset identified insource_respNfor subjects present indataset_adslbut not present indatasetor the dataset identified insource_resp.
AVALis derived usingAVALCas input to the function specified inaval_fun.The variables specified by
set_values_toare added to the new observations with values equal to the values specified in the same.The new observations are added to
dataset. Variables held in common betweendatasetanddataset_adslare kept for the new observations, and are populated with their values fromdataset_adsl.
See also
ADRS Functions for adding Parameters:
derive_param_bor(),
derive_param_confirmed_bor(),
derive_param_confirmed_resp(),
derive_param_response()
Examples
library(lubridate)
library(dplyr)
library(admiral)
adsl <- tibble::tribble(
~USUBJID, ~TRTSDT,
"01", ymd("2020-01-14"),
"02", ymd("2021-02-16"),
"03", ymd("2021-03-09"),
"04", ymd("2021-04-21")
) %>%
mutate(STUDYID = "AB42")
adrs <- tibble::tribble(
~USUBJID, ~PARAMCD, ~AVALC, ~ADT,
"01", "RSP", "Y", ymd("2021-03-14"),
"02", "RSP", "N", ymd("2021-05-07"),
"03", "RSP", "N", NA,
"04", "RSP", "N", NA,
"01", "PD", "N", NA,
"02", "PD", "Y", ymd("2021-05-07"),
"03", "PD", "N", NA,
"04", "PD", "N", NA,
"01", "OVR", "SD", ymd("2020-03-14"),
"01", "OVR", "PR", ymd("2021-04-13"),
"02", "OVR", "PR", ymd("2021-04-08"),
"02", "OVR", "PD", ymd("2021-05-07"),
"02", "OVR", "CR", ymd("2021-06-20"),
"03", "OVR", "SD", ymd("2021-03-30"),
"04", "OVR", "NE", ymd("2021-05-21"),
"04", "OVR", "NA", ymd("2021-06-30"),
"04", "OVR", "NE", ymd("2021-07-24"),
"04", "OVR", "ND", ymd("2021-09-04"),
) %>%
mutate(STUDYID = "AB42", ANL01FL = "Y") %>%
derive_vars_merged(
dataset_add = adsl,
by_vars = vars(STUDYID, USUBJID),
new_vars = vars(TRTSDT)
)
pd <- date_source(
dataset_name = "adrs",
date = ADT,
filter = PARAMCD == "PD" & AVALC == "Y" & ANL01FL == "Y"
)
resp <- date_source(
dataset_name = "adrs",
date = ADT,
filter = PARAMCD == "RSP" & AVALC == "Y" & ANL01FL == "Y"
)
derive_param_clinbenefit(
dataset = adrs,
dataset_adsl = adsl,
filter_source = PARAMCD == "OVR" & ANL01FL == "Y",
source_resp = resp,
source_pd = pd,
source_datasets = list(adrs = adrs),
reference_date = TRTSDT,
ref_start_window = 28,
set_values_to = vars(
PARAMCD = "CBR"
)
) %>%
filter(PARAMCD == "CBR")
#> # A tibble: 4 x 8
#> USUBJID PARAMCD AVALC ADT STUDYID ANL01FL TRTSDT AVAL
#> <chr> <chr> <chr> <date> <chr> <chr> <date> <dbl>
#> 1 01 CBR Y 2020-03-14 AB42 Y 2020-01-14 1
#> 2 02 CBR Y 2021-04-08 AB42 Y 2021-02-16 1
#> 3 03 CBR N NA AB42 NA 2021-03-09 0
#> 4 04 CBR N NA AB42 NA 2021-04-21 0