Learn R Programming

DynTxRegime (version 3.01)

.newModelObjSubset: Create an object of class

Description

Given a list of objects of class "modelObjSubset", create a list storing the objects according to decision point. Method is not exported.

Usage

.newModelObjSubset(object)

Arguments

object
An object of class "list", each element an object of class "ModelObjSubset".

Value

If object contains subset models for only a single decision point, returns an object of class "ModelObj_SubsetList".

If object contains subset models for multiple decision points, returns an object of class "ModelObj_SubsetList_DecisionPointList".

Details

When subset modeling is used, users provide methods of DynTxRegime a list of objects created by calls to buildModelObjSubset(). This method determines if that list provides subset models for a single decision point (stored as an object of class "ModelObj_SubsetList" or for multiple decision points (subset models are grouped according to their decision point and stored as an object of class "ModelObj_SubsetList_DecisionPointList."

Examples

Run this code

  models <- list()

  models[[1L]] <- buildModelObjSubset(model = ~x1, 
                                      solver.method = 'lm', 
                                      subset = "subset1", 
                                      dp = 1L)

  models[[2L]] <- buildModelObjSubset(model = ~x2, 
                                      solver.method = 'lm', 
                                      subset = "subset2", 
                                      dp = 1L)

  result <- DynTxRegime:::.newModelObjSubset(models)

  is(result)

  models[[3L]] <- buildModelObjSubset(model = ~x3,
                                      solver.method = 'lm', 
                                      subset = "subset1", 
                                      dp = 2L)

  result <- DynTxRegime:::.newModelObjSubset(models)

  is(result)

Run the code above in your browser using DataLab