PredictRule {DevTreatRules} | R Documentation |
Get the treatment rule implied by BuildRule()
Description
Map the object returned by BuildRule()
to the treatment rule corresponding to a particular dataset
Usage
PredictRule(
BuildRule.object,
new.X,
desirable.outcome = NULL,
clinical.threshold = 0,
return.predicted.response = FALSE
)
Arguments
BuildRule.object |
The object returned by the |
new.X |
A data frame representing the dataset for which the treatment rule is desired. |
desirable.outcome |
A logical equal to |
clinical.threshold |
A numeric equal 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 |
return.predicted.response |
logical indicating whether the predicted response variable (for |
Value
If
return.predicted.response=FALSE
(the default), then the single object returned is a numeric vector of 0s and 1s, with length equal to the number of rows innew.X
, where a 0 indicates treatment is not recommended and a 1 indicates treatment is recommended for the corresponding observation innew.X
.If
return.predicted.response=TRUE
, then the object returned is a list with some combination of the following components (depending on which prediction approach underlies theBuildRule.object
).-
recommended.treatment
: A numeric vector of 0s and 1s, with length equal to the number of rows innew.X
, where a 0 indicates treatment is not recommended and a 1 indicates treatment is recommended for the corresponding observation innew.X
. -
predicted.outcome
: A numeric vector showing the predicted values of the score function mapped torecommended.treatment
. Only returned ifreturn.predicted.response=TRUE
and the approach underlyingBuildRule.object
. was ‘direct.interactions’. -
predicted.outcome.under.control
: A numeric vector showing the predicted values of the outcome under no treatment which, along withpredicted.outcome.under.treatment
, corresponds torecommended.treatment
. Only returned ifreturn.predicted.response=TRUE
and the approach underlyingBuildRule.object
. was ‘split.regression’. -
predicted.outcome.under.treatment
: A numeric vector showing the predicted values of the outcome under treatment which, along withpredicted.outcome.under.control
, corresponds torecommended.treatment
. Only returned ifreturn.predicted.response=TRUE
and the approach underlyingBuildRule.object
. was ‘split.regression’. -
predicted.treatment.prob
: A numeric vector showing the predicted treatment probability that corresponds torecommended.treatment
. Only returned ifreturn.predicted.response=TRUE
and the approach underlyingBuildRule.object
. was ‘OWL.framework’.
-
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")
one.prediction <- PredictRule(BuildRule.object=one.rule,
new.X=validation.data[, c("age", paste0("gene_", 1:10))],
desirable.outcome=TRUE,
clinical.threshold=0)
table(one.prediction)