Learn R Programming

DynTxRegime (version 3.2)

Regime-class: Class "Regime"

Description

All information regarding user defined regime function for a single decision point.

Arguments

Objects from the Class

Objects can be created by calls of the form new("Regime", ...). These objects are for convenience in package development and should not be created by users.

Slots

nVars:

An object of class "integer." The number of parameters in regime function.

vNames:

An object of class "character." The names of parameters in regime function.

func:

An object of class "function." The user provided function defining treatment regime.

pars:

An object of class "numeric." The regime parameter estimates.

Extends

Classes "RegimeObject-class" and "SingleDecisionPoint-class" directly.

Methods

.getNumPars

signature(object = "Regime"): Retrieve the number of parameters. Method not exported.

.getParNames

signature(object = "Regime"): Retrieve the names of the parameters. Method not exported.

.getPars

signature(object = "Regime"): Retrieve the parameter estimates. Method not exported.

.getRegimeFunction

signature(object = "Regime"): Retrieve the decision rule function. Method not exported.

.predictOptimalTx

signature(x = "Regime", newdata = "data.frame"): Estimate the optimal treatment for newdata. Method not exported.

.setPars

signature(object = "Regime"): Set the parameter estimates. Method not exported.

regimeCoef

signature(object = "Regime"): Retrieve regime parameter estimates.

Examples

Run this code
# NOT RUN {
showClass("Regime")

data <- data.frame(x1 = rnorm(10), x2 = rnorm(10), x3 = rnorm(10))

regime <- function(a,b,c,data){
            return(a*data$x1 + b*data$x2 + c*data$x3 < 0)
          }

regObj <- new("Regime",
              nVars = 3L,
              vNames = c("a","b","c"),
              func = regime,
              pars = c(0.1,0.2,0.3))

is(regObj)

DynTxRegime:::.getNumPars(object = regObj)
DynTxRegime:::.getParNames(object = regObj)
DynTxRegime:::.getPars(object = regObj)
DynTxRegime:::.getRegimeFunction(object = regObj)
DynTxRegime:::.predictOptimalTx(x = regObj, newdata = data)
regObj <- DynTxRegime:::.setPars(object = regObj, pars = c(0.2,0.1,0.3))
DynTxRegime:::.getPars(object = regObj)
regimeCoef(object = regObj)
# }

Run the code above in your browser using DataLab