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 BuildRule() function.

new.X

A data frame representing the dataset for which the treatment rule is desired.

desirable.outcome

A logical equal to TRUE if higher values of the outcome are considered desirable (e.g. for a binary outcome, 1 is more desirable than 0). The OWL.framework and OWL approaches to treatment rule estimation require a desirable outcome.

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 BuildRuleObject was specified and derived from the split-regression or direct-interactions approach. Defaults to 0.

return.predicted.response

logical indicating whether the predicted response variable (for split.regression, OWL.framework, and OWL approaches) or score function (for direct.interactions) should be returned in addition to its mapping to a binary treatment recommendation. Default is FALSE.

Value

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)

[Package DevTreatRules version 1.1.0 Index]