EvaluateRule {DevTreatRules} | R Documentation |
Evaluate a Treatment Rule
Description
Perform principled evaluation of a treatment rule (using the IPW approach to account for potential confounding) on a dataset that is independent of the development dataset on which the rule was developed, either to perform model selection (with a validation dataset) or to obtain trustworthy estimates of performance for a pre-specified treatment rule (with an evaluation dataset).
Usage
EvaluateRule(
evaluation.data,
BuildRule.object = NULL,
B = NULL,
study.design,
name.outcome,
type.outcome,
desirable.outcome,
separate.propensity.estimation = TRUE,
clinical.threshold = 0,
name.treatment,
names.influencing.treatment,
names.influencing.rule,
propensity.method = NULL,
show.treat.all = TRUE,
show.treat.none = TRUE,
truncate.propensity.score = TRUE,
truncate.propensity.score.threshold = 0.05,
observation.weights = NULL,
additional.weights = rep(1, nrow(evaluation.data)),
lambda.choice = c("min", "1se"),
propensity.k.cv.folds = 10,
bootstrap.CI = FALSE,
bootstrap.CI.replications = 1000,
bootstrap.type = "basic"
)
Arguments
evaluation.data |
A data frame representing the *validation* or *evaluation* dataset used to estimate the performance of a rule that was developed on an independent development dataset. |
BuildRule.object |
The object returned by the |
B |
A numeric vector representing a pre-specified treatment rule, which must have length equal to the number of rows in |
study.design |
Either ‘observational’, ‘RCT’, or ‘naive’. For the |
name.outcome |
A character indicating the name of the outcome variable in |
type.outcome |
Either ‘binary’ or ‘continuous’, the form of |
desirable.outcome |
A logical equal to |
separate.propensity.estimation |
A logical equal to |
clinical.threshold |
A numeric equal to a positive number above which the predicted outcome under treatment must be superior to the predicted outcome under control for treatment to be recommended. Only used when |
name.treatment |
A character indicating the name of the treatment variable in |
names.influencing.treatment |
A character vector (or element) indicating the names of the variables in |
names.influencing.rule |
A character vector (or element) indicating the names of the variables in |
propensity.method |
One of‘logistic.regression’, ‘lasso’, or ‘ridge’. This is the underlying regression model used to estimate propensity scores (for |
show.treat.all |
A logical variable dictating whether summaries for the naive rule that assigns treatment to all observations are reported, which help put the performance of the estimated treatment rule in context. Default is TRUE |
show.treat.none |
A logical variable dictating whether summaries for the naive rule that assigns treatment to no observations are reported, which help put the performance of the estimated treatment rule in context. Default is TRUE |
truncate.propensity.score |
A logical variable dictating whether estimated propensity scores less than |
truncate.propensity.score.threshold |
A numeric value between 0 and 0.25. |
observation.weights |
A numeric vector equal to the number of rows in |
additional.weights |
A numeric vector of observation weights that will be multiplied by IPW weights in the rule evaluation stage, with length equal to the number of rows in |
lambda.choice |
Either ‘min’ or ‘1se’, corresponding to the |
propensity.k.cv.folds |
An integer dictating how many folds to use for K-fold cross-validation that chooses the tuning parameter when |
bootstrap.CI |
Logical indicating whether the ATE/ABR estimates returned by |
bootstrap.CI.replications |
An integer specifying how many bootstrap replications should underlie the computed CIs. Default is 1000. |
bootstrap.type |
One character element specifying the type of bootstrap CI that should be computed. Currently the only supported option is |
Value
A list with the following components
-
recommended.treatment
: A numeric vector of 0s and 1s, with length equal to the number of rows inevaluation.data
, where a 0 indicates treatment is not recommended and a 1 indicates treatment is recommended for the corresponding observation inevaluation.data
. -
fit.object
: A list consisting of one of the following: the propensity scores estimated in the test-positives and in the test-negatives (ifseparate.propensity.estimation=TRUE
,study.design=
‘observational’, andobservation.weights=NULL
); the propensity scores estimated in the combined sample (ifseparate.propensity.estimation=FALSE
,study.design=
‘observational’, andobservation.weights=NULL
); and simply is simply null ifstudy.design=
‘RCT’ (in which case propensity score would just be the inverse of the sample proportion receiving treatment) -
summaries
: a matrix with columns reporting the following summaries of treatment rule performance: the number of observations inevaluation.data
recommended to receive treatment. (n.positives
); the estimated average treatment effect among those recommended to receive treatment (ATE.positives
); the number of observations inevaluation.data
recommended to not receive treatment (n.negatives
); the estimated average treatment effect among those recommended to not receive treatment (ATE.negatives
); the estimated average benefit of using the rule, with the weighted average of ATE.positives and -1 * ATE.negatives where weights are the proportions of test-positives and test-negatives (ABR
). Ifbootstrap.CI=TRUE
, then 4 additional columns are included, showing the lower bound (LB) and upper bound (UB) of the 95% CIs forATE.positives
andATE.negatives
.
Examples
set.seed(123)
example.split <- SplitData(data=obsStudyGeneExpressions,
n.sets=3, split.proportions=c(0.5, 0.25, 0.25))
development.data <- example.split[example.split$partition == "development",]
validation.data <- example.split[example.split$partition == "validation",]
one.rule <- BuildRule(development.data=development.data,
study.design="observational",
prediction.approach="split.regression",
name.outcome="no_relapse",
type.outcome="binary",
desirable.outcome=TRUE,
name.treatment="intervention",
names.influencing.treatment=c("prognosis", "clinic", "age"),
names.influencing.rule=c("age", paste0("gene_", 1:10)),
propensity.method="logistic.regression",
rule.method="glm.regression")
split.validation <- EvaluateRule(evaluation.data=validation.data,
BuildRule.object=one.rule,
study.design="observational",
name.outcome="no_relapse",
type.outcome="binary",
desirable.outcome=TRUE,
name.treatment="intervention",
names.influencing.treatment=c("prognosis", "clinic", "age"),
names.influencing.rule=c("age", paste0("gene_", 1:10)),
propensity.method="logistic.regression",
bootstrap.CI=FALSE)
split.validation[c("n.positives", "n.negatives",
"ATE.positives", "ATE.negatives", "ABR")]