RegressionClass: R6 class for defining regression models that evaluate...

Description Usage Format Details Methods Active Bindings See Also Examples

Description

RegressionClass provides multiple options used when estimating a conditional density P(A|W,E). A can be multivariate, if so, hazard specification will factorize P(A|W,E) = P(A[1],..., A[M]|W,E) as a sequence P(A[1]|W,E) * P(A[2]|W, E, A[1]) * ... * P(A[M]|W, E, A[1],..., A[M-1]), where each of the compoenents A[m] can be either binary, categorical or continuous, and each of the conditional densities P(A[m]|W, E, A[1],...,A[m-1]) will be controlled by a new instance of GenericModel class. If A[m] binary, P(A[m]|W, E, A[1],...,A[m-1]) will be esimtated by a user-specific library of candidate algorithms, including parametric estimators such as logistic model with only main terms, and data-adaptive estimator such as super-learner algorithms. If A[m] continuous (or categorical), P(A[m]|W, E, A[1],...,A[m-1]) will then be controlled by a new instance of ContinModel class (or CategorModel class). Note that each GenericModel, ContinModel and CategorModel class will accompany with an adjunctive clone of a parent RegressionClass class. The automatically recursive process of defining new instances of GenericModel and cloning RegressionClass classes won't stop until the entire sequence of binary regressions that represents P(A|W,E) is constructed.

Usage

1

Format

An R6Class generator object

Details

Methods

new(outvar.class = gvars$sVartypes$bin, outvar, predvars, subset_vars, intrvls, ReplMisVal0 = TRUE, estimator = getopt("Qestimator"), parfit = getopt("parfit"), pool_cont = getopt("poolContinVar")

Instantiate an new instance of RegressionClass

ChangeManyToOneRegresssion(k_i, reg)

Clone the parent RegressionClass (reg) that include length(self$outvar) regressions, and reset self to a single univariate k_i regression for outcome self$outvar[[k_i]].

resetS3class()

Reset the object class to "RegressionClass" and "R6".

Active Bindings

S3class(newclass)

...

get.reg

...

See Also

DatKeepClass, GenericModel, ContinModel, CategorModel

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
data(indSample.iid.cA.cY_list)
indSample.iid.cA.cY <- indSample.iid.cA.cY_list$indSample.iid.cA.cY
nodes <- list(Ynode = "Y", Anodes = "A", WEnodes = c("W1", "W2", "W3", "W4"))
tmleCom_Options(maxNperBin = nrow(indSample.iid.cA.cY))

OData.g0 <- DatKeepClass$new(Odata = indSample.iid.cA.cY, nodes = nodes)
h.g0.sVars <- tmleCommunity:::define_regform(A ~ W1 + W2 + W3 + W4) 
A.nms.g0 <- h.g0.sVars$outvars
regclass.g0 <- RegressionClass$new(outvar = A.nms.g0, predvars = h.g0.sVars$predvars,
                                   subset_vars = lapply(A.nms.g0, function(var) {var}),
                                   outvar.class = OData.g0$type.sVar[A.nms.g0])
regclass.g0$estimator  # "speedglm__glm"
regclass.g0$pool_cont  # FALSE (Don't pool across all bins of a continuous exposure)
regclass.g0$parfit     # FALSE (Don't preform parallel computing in estimation)

# Clone the parent regclass.g0 and reset to a single univariate k_i regression 
# for outcome regclass.g0$outvar[[k_i]]
k_i <- 1
reg_i <- regclass.g0$clone()
reg_i$ChangeManyToOneRegresssion(k_i, regclass.g0)
genericmodels.g0.A1 <- ContinModel$new(reg = reg_i, DatKeepClass.g0 = OData.g0)

chizhangucb/tmleCommunity documentation built on May 20, 2019, 3:34 p.m.