Learn R Programming

DynTxRegime (version 3.01)

iqLearnFSC: IQ-Learning: Regression of Estimated Second-Stage Contrasts

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. iqLearnFSC implements the regression of the estimated second-stage contrasts in the IQ-Learning algorithm (IQ3).

Usage

iqLearnFSC(..., 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 contrasts 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 contrasts 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_C" that inherits directly from class "DynTxRegime."

Methods

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

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

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

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

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

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

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

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

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

residuals
signature(object = "IQLearnFS_C"): Retrieve residuals used by statistical methods.

sd
signature(x = "IQLearnFS_C"): Retrieve the standard deviation of residuals.

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

summary
signature(object = "IQLearnFS_C"): 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, iqLearnFSM, iqLearnFSV

Examples

Run this code
#### 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 contrast step

  # Coefficients of the outcome regression
  coef(iqFSC)

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

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

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

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

  # Residuals of regression
  residuals(iqFSC)

  # Standard deviation of residuals
  sd(iqFSC)

  # Show main results of method
  show(iqFSC)

  # Show summary results of method
  summary(iqFSC)

Run the code above in your browser using DataLab