Learn R Programming

DynTxRegime (version 3.01)

.newTypedSimpleFit: Complete Outcome Regression Step When Single Model.

Description

Complete an outcome regression step when iterative method is not required and subsets are not used for modeling. Method is not exported.

Usage

.newTypedSimpleFit(moMain, moCont, txInfo, ...)

# S4 method for modelObj,modelObj,TxInfoNoSubsets .newTypedSimpleFit(moMain, moCont, txInfo, data, response, suppress) # S4 method for modelObj,NULL,TxInfoNoSubsets .newTypedSimpleFit(moMain, moCont, txInfo, data, response, suppress) # S4 method for NULL,modelObj,TxInfoNoSubsets .newTypedSimpleFit(moMain, moCont, txInfo, data, response, suppress) # S4 method for modelObj,modelObj,TxInfoWithSubsets .newTypedSimpleFit(moMain, moCont, txInfo, data, response, suppress) # S4 method for modelObj,NULL,TxInfoWithSubsets .newTypedSimpleFit(moMain, moCont, txInfo, data, response, suppress) # S4 method for NULL,modelObj,TxInfoWithSubsets .newTypedSimpleFit(moMain, moCont, txInfo, data, response, suppress)

Arguments

moMain
"modelObj" for main effects component of outcome.
moCont
"modelObj" for contrast component of outcome.
txInfo
Treatment information.
...
Used to pass arguments that are required but the class of which does not determine the method that is selected.
data
"data.frame" of covariates and treatment history.
response
Vector of outcome of interest.
suppress
T/F indicating if screen prints are generated.

Examples

Run this code

data(bmiData)

y <- -(bmiData$month12BMI - bmiData$month4BMI) / bmiData$month4BMI * 100

moMain <- buildModelObj(model = ~ parentBMI + baselineBMI + month4BMI, 
                        solver.method = 'lm')
moCont <- buildModelObj(model = ~ parentBMI + baselineBMI + month4BMI, 
                        solver.method = 'lm')

# Treatment Object
txInfo <- DynTxRegime:::.newTxInfo(fSet = NULL, 
                                   txName = "A2", 
                                   data = bmiData, 
                                   suppress = TRUE, 
                                   verify = TRUE)

obj <- DynTxRegime:::.newTypedSimpleFit(moMain = moMain, 
                                        moCont = moCont,  
                                        txInfo = txInfo, 
                                        data = bmiData,  
                                        response = y,  
                                        suppress = TRUE)

is(obj)
coef(obj)
fitObject(obj)
plot(obj)
predict(obj)
predict(obj, bmiData)
DynTxRegime:::.predictAllTreatments(object = obj, data = bmiData)
print(obj)
show(obj)
summary(obj)

obj <- DynTxRegime:::.newTypedSimpleFit(moMain = moMain, 
                                        moCont = NULL,  
                                        txInfo = txInfo, 
                                        data = bmiData,  
                                        response = y,  
                                        suppress = TRUE)

is(obj)
print(obj)

obj <- DynTxRegime:::.newTypedSimpleFit(moMain = NULL, 
                                        moCont = moCont,  
                                        txInfo = txInfo, 
                                        data = bmiData,  
                                        response = y,  
                                        suppress = TRUE)


is(obj)
print(obj)

fSet <- function(data){
          subsets <- list(list("subset1", c("CD","MR")),
                          list("subset2", c("CD","MR")))
         txOpts <- character(nrow(data))
         txOpts[data$A1 == "CD"] <- "subset1"
         txOpts[data$A1 == "MR"] <- "subset2"
         return(list("subsets" = subsets, "txOpts" = txOpts))
        }

# Integer treatment with subsetting
txInfo <- DynTxRegime:::.newTxInfo(fSet = fSet, 
                                   txName = "A2", 
                                   data = bmiData, 
                                   suppress = TRUE, 
                                   verify = TRUE)

obj <- DynTxRegime:::.newTypedSimpleFit(moMain = moMain, 
                                        moCont = moCont, 
                                        txInfo = txInfo, 
                                        data = bmiData, 
                                        response = y, 
                                        suppress = TRUE)

is(obj)
coef(obj)
fitObject(obj)
plot(obj)
predict(obj)
predict(obj, bmiData)
DynTxRegime:::.predictAllTreatments(object = obj, data = bmiData)
print(obj)
show(obj)
summary(obj)


obj <- DynTxRegime:::.newTypedSimpleFit(moMain = moMain, 
                                        moCont = NULL, 
                                        txInfo = txInfo, 
                                        data = bmiData, 
                                        response = y, 
                                        suppress = TRUE)

is(obj)
print(obj)

obj <- DynTxRegime:::.newTypedSimpleFit(moMain = NULL, 
                                        moCont = moCont, 
                                        txInfo = txInfo, 
                                        data = bmiData, 
                                        response = y, 
                                        suppress = TRUE)
is(obj)
print(obj)

Run the code above in your browser using DataLab