Description Usage Format Details Methods Active Bindings See Also Examples
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.
1 |
An R6Class
generator object
outvar.class
- Character vector of outcome variable classes (of length(outvar)): one of bin
, cont
, cat
.
outvar
- Character vector of regression outcome variable names.
predvars
- Character vector of regression-specific predictor names or a pool of all available predictor names.
reg_hazard - Logical, hazard fitting method. If TRUE, factorize P(outvar | predvars) into \prod_jP(outvar[j] | predvars) for each j.
subset_vars
- Named list for subset variables/ expression (later converted to logical vector).
ReplMisVal0
- Logical. If TRUE, user-supplied gvars$misXreplace (Default to 0) will be used to replace all gvars$misval
among predictors (Default to TRUE).
nbins
- Number of bins used for estimation of a continuous outvar, defined in ContinModel$new().
estimator
- Character, one of "speedglm__glm" (default), "glm__glm", "h2o__ensemble", "SuperLearner". The estimator for which to fit
regression model. For "h2o__ensemble" and "SuperLearner", users can specify the data-adaptive algorithms through tmleCom_Options
.
parfit
- Logical. If TRUE, use parallel computing on binary regressions. See foreach::foreach
.
pool_cont
- Logical. If TRUE, pool over bins of a continuous outvar and fit one regression, along with bin_ID as an extra variable.
outvars_to_pool
- Character vector of bin names of a continuous outvars, should be identical to bin_nms
.
intrvls
- Numeric vector defining the number and positions of the bins or a named list of numeric vectors if 2 or more outvars.
If not specified and outvar continuous, intervals will be determined in ContinModel
through DatKeepClass$detect.sVar.intrvls
.
intrvls.width
- Named numeric vector of bin widths for each bin in self$intrvls
. If not specified, default to 1 if
outvar binary, default to diff(self$intrvls)
if outvar continuous,
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".
S3class(newclass)
...
get.reg
...
DatKeepClass
, GenericModel
, ContinModel
, CategorModel
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.