Learn R Programming

DynTxRegime (version 3.2)

iqLearnFSV: IQ-Learning: Variance of the Regression of the Estimated Second-Stage Contrast (IQ3)

Description

Estimates the variance function of the regression of the estimated second-stage contrast by fitting a log-linear model to the residuals.

Usage

iqLearnFSV( ..., object, moMain, moCont, data = NULL, iter = 0, verbose = TRUE)

Arguments

ignored. Included to require named input.

object

An object of class "IQLearnFS_C." The value object returned from a previous call to iqLearnFSC()

moMain

An object of class "modelObj." This object specifies the model for the main effects component for the regression of the residual and the R methods to be used to obtain parameter estimates and predictions. The method specified to obtain predictions must return the prediction on the scale of the response variable.

moCont

An object of class "modelObj." This object specifies the model for the contrast component for the regression of the residual and the R methods to be used to obtain parameter estimates and predictions. The method specified to obtain predictions must return the prediction on the scale of the response variable.

data

An object of class "data.frame." The covariates and treatment histories.

iter

An object of class "numeric." If >0, the iterative method will be used to obtain parameter estimates in the outcome regression step. See iter for further information.

verbose

An object of class "logical." If FALSE, screen prints will be suppressed.

Value

Returns an object of class "IQLearnFS_VHet" that inherits directly from class "DynTxRegime."

Methods

coef

signature(object = "IQLearnFS_VHet"): Retrieve parameter estimates for all regression steps.

DTRstep

signature(object = "IQLearnFS_VHet"): Retrieve description of method used to create object.

estimator

signature(x = "IQLearnFS_VHet"): Retrieve the estimated value of the estimated optimal regime for the training data set.

fitObject

signature(object = "IQLearnFS_VHet"): Retrieve value object returned by regression methods.

optTx

signature(x = "IQLearnFS_VHet", newdata = "missing"): Retrieve the estimated optimal treatment regime for training data set.

optTx

signature(x = "IQLearnFS_VHet", newdata = "data.frame"): Estimate the optimal treatment regime for newdata.

outcome

signature(x = "IQLearnFS_VHet"): Retrieve value object returned by outcome regression methods.

plot

signature(x = "IQLearnFS_VHet"): Generate plots for regression analyses.

print

signature(object = "IQLearnFS_VHet"): Print main results of analysis.

qqPlot

signature(x = "IQLearnFS_VHet"): Generate a qq-plot.

residuals

signature(object = "IQLearnFS_VHet"): Retrieve standardized fitted residuals.

show

signature(object = "IQLearnFS_VHet"): Show main results of analysis.

summary

signature(object = "IQLearnFS_VHet"): Retrieve summary information from regression analyses.

References

Laber, E. B., Linn, K. A., and Stefanski, L.A. (2014). Interactive model building for Q-learning. Biometrika, 101, 831--847.

See Also

iqLearnFSM, iqLearnFSC, iqLearnSS

Examples

Run this code
# NOT RUN {
#### Full IQ-Learning Algorithm

## Load and process data set
  data(bmiData)

  # define response y to be the negative 12 month
  # change in BMI from baseline
  bmiData$y <- -100*(bmiData[,6] - bmiData[,4])/bmiData[,4]

## Second-stage regression (IQ1)
  # Create modelObj object for main effect component
  moMain <- buildModelObj(model = ~ gender + parentBMI + month4BMI,
                          solver.method = 'lm')

  # Create modelObj object for contrast component
  moCont <- buildModelObj(model = ~ parentBMI + month4BMI,
                          solver.method = 'lm')

  iqSS <- iqLearnSS(moMain = moMain, moCont = moCont, 
                    data = bmiData, response = bmiData$y, txName = "A2", 
                    iter = 0L)

## Model conditional mean of main effects function (IQ2)
  # Create modelObj object for main effect component
  moMain <- buildModelObj(model = ~ gender + race + parentBMI + baselineBMI,
                          solver.method = 'lm')

  # Create modelObj object for contrast component
  moCont <- buildModelObj(model = ~ gender + parentBMI + month4BMI,
                          solver.method = 'lm')

  iqFSM <- iqLearnFSM(moMain = moMain, moCont = moCont, 
                      data = bmiData, response = iqSS, txName = "A1", 
                      iter = 0L)

 
## Model conditional mean of contrast function (IQ3)
  # Create modelObj object for main effect component
  moMain <- buildModelObj(model = ~ gender + race + parentBMI + baselineBMI,
                          solver.method = 'lm')

  # Create modelObj object for contrast component
  moCont <- buildModelObj(model = ~ gender + parentBMI + month4BMI,
                          solver.method = 'lm')

  iqFSC <- iqLearnFSC(moMain = moMain, moCont = moCont, 
                      data = bmiData, response = iqSS, txName = "A1", 
                      iter = 0L)

## Estimated optimal treatment and value when variance assumed constant
  # optimal treatment
  ot <- optTx(iqFSM, y = iqFSC, dens = 'nonpar')

  # estimated value
  est <- estimator(x = iqSS, y = iqFSM, z = iqFSC, dens = 'nonpar')

## Log-Linear Variance Modeling (IQ4)

  # heteroskedastic variance
  # Create modelObj object for main effect component
  moMain <- buildModelObj(model = ~ gender + race + parentBMI + baselineBMI,
                          solver.method = 'lm')

  # Create modelObj object for contrast component
  moCont <- buildModelObj(model = ~ parentBMI + baselineBMI,
                          solver.method = 'lm')


  iqFSV <- iqLearnFSV(object = iqFSC,
                      moMain = moMain, moCont = moCont, 
                      data = bmiData, txName = "A1", 
                      iter = 0L)

## Estimated optimal treatment and value with log-linear variance modeling
  # optimal treatment
  ot <- optTx(iqFSM, y = iqFSC, z = iqFSV, dens = 'nonpar')

  # estimated value
  est <- estimator(x = iqSS, y = iqFSM, z = iqFSC, w = iqFSV, dens = 'nonpar')

## Available methods for variance step

  # Coefficients of the outcome regression
  coef(iqFSV)

  # Description of method used to obtain object
  DTRstep(iqFSV)

  # Value object returned by outcome regression method
  fitObject(iqFSV)

  # Value object returned by outcome regression method
  outcome(iqFSV)

  # Plots if defined by outcome regression method
  dev.new()
  par(mfrow = c(2,4))
  plot(iqFSV)
  plot(iqFSV, suppress = TRUE)

  # qq-plot
  dev.new()
  qqplot(iqFSV)

  # Show main results of method
  show(iqFSV)

  # Show summary results of method
  summary(iqFSV)

# }

Run the code above in your browser using DataLab