buildModelObjSubset {DynTxRegime} | R Documentation |
Extends the buildModelObj() function of package modelObj. Here, the returned model object includes a specification of the decision point and subset of the data to which the model is to be applied.
buildModelObjSubset(
...,
model,
solver.method,
solver.args = NULL,
predict.method = NULL,
predict.args = NULL,
dp = 1L,
subset = NA
)
... |
ignored. Included to require named input. |
model |
An object of class |
solver.method |
An object of class |
solver.args |
An object of class solver.method = "glm" solver.args = list("family"=binomial) See Details section for further information. |
predict.method |
An object of class |
predict.args |
An object of class predict.method = "predict.glm" predict.args = list("type"="response"). See Details section for further information. |
dp |
An object of class |
subset |
An object of class |
In some settings, an analyst may want to use different models for unique
subsets of the data. buildModelObjSubset()
provides a mechanism for
users to define models for such subset. Specifically, models are specified
in connection with the decision point and subset to which they are to be
applied.
See ?modelObj for further details
An object of class ModelObjSubset
, which contains a
complete description of the conditions under which a model is to be
used and the R methods to be used to obtain parameter estimates and
predictions.
# Consider a 2 decision point trial. At the 1st decision point, the subset of
# treatment options available to each patient is always set "set1."
# At the 2nd decision point, some patients are eligible to receive
# treatment from set "set2a" and others from set "set2b." The outcome
# for these subsets will be modeled as ~ x1 + x2 and ~ x2 + x3, respectively.
#
# All parameter estimates are to be obtained used lm and predictions obtained using predict.
#
# The following illustrates how to build these model objects.
model <- list()
model[[1]] <- buildModelObjSubset(dp = 1, subset = "set1",
model = ~ x1 + x2 + x3, solver.method = 'lm')
model[[2]] <- buildModelObjSubset(dp = 2, subset = "set2a",
model = ~ ~ x1 + x2, solver.method = 'lm')
model[[3]] <- buildModelObjSubset(dp = 2, subset = "set2b",
model = ~ x2 + x3, solver.method = 'lm')