Learn R Programming

DynTxRegime (version 3.2)

iqLearnFSM: IQ-Learning: Regression of Estimated Second-Stage Main Effects

Description

Estimate an optimal dynamic treatment regime using the Interactive Q-learning (IQ-learning) algorithm when the data has been collected from a two-stage randomized trial with binary treatments. iqLearnFSM implements the regression of the estimated second-stage main effects (IQ2).

Usage

iqLearnFSM(..., moMain, moCont, data, response, txName, iter = 0L, verbose = TRUE)

Arguments

ignored. Included to require named input.

moMain

An object of class "modelObj." This object specifies the main effects component of the model for the regression of the estimated second-stage main effects 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 contrasts component of the model for the regression of the estimated second-stage main effects 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.

response

An object of class "IQLearnSS." The object returned by a prior call to iqLearnSS().

txName

An object of class "character." The column header of the stage treatment variable in input data. The treatment variable must be binary and will be recoded as -1/+1 if not provided as such.

iter

An object of class "integer." 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_ME" that inherits directly from class "DynTxRegime."

Methods

coef

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

DTRstep

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

estimator

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

fitObject

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

optTx

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

optTx

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

outcome

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

plot

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

print

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

show

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

summary

signature(object = "IQLearnFS_ME"): 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

iqLearnSS, iqLearnFSC, iqLearnFSV

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 main effects step

  # Coefficients of the outcome regression
  coef(iqFSM)

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

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

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

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

  # Show main results of method
  show(iqFSM)

  # Show summary results of method
  summary(iqFSM)

# }

Run the code above in your browser using DataLab