Learn R Programming

iqLearn (version 1.5)

learnIQ1main: IQ-learning: main effect term regression

Description

Fits a linear regression of the estimated main effect term on first-stage history and treatment.

Usage

learnIQ1main(object, ...)

# S3 method for formula learnIQ1main(formula, data, treatName, intNames, s2object, ...) # S3 method for default learnIQ1main(object, H1Main, A1, s1mainInts, ...)

Arguments

formula

formula for the main effect term regression

data

data frame containing variables used in formula

treatName

character string indicating the stage 1 treatment name

intNames

vector of characters indicating the names of the variables that interact with the stage 1 treatment in the main effect term regression model

s2object

object of type learnIQ2

object

object of type learnIQ2

H1Main

matrix or data frame of first-stage covariates to include as main effects in the linear model

A1

vector of first-stage randomized treatments

s1mainInts

indices pointing to columns of H1Main that should be included as treatment interaction effects in the linear model

other arguments to be passed to lm()

Value

alphaHat0

estimated main effect coefficients; first is the intercept

alphaHat1

estimated treatment interaction coefficients; first is the main effect of the first-stage treatment

s1MainFit

lm() object of the main effect term regression fit

mainPos

vector of predicted values with \(A1\)=1 for all patients

mainNeg

vector of predicted values with \(A1\)=-1 for all patients

s1mainInts

indicies of variables in H1Main included as treatment interactions in the model; same as input s1mainInts

A1

vector of first-stage randomized treatments; same as input A1

Details

Fits a model of the form $$E (H_{20}^{T}\beta_{20} | H_1, A_1) = H_{10}^{T}\alpha_{0} + A_{1}H_{11}^{T}\alpha_{1},$$ where \(H10\) and \(H11\) are summaries of \(H1\). For an object of type learnIQ1main, summary(object) and plot(object) can be used for evaluating model fit.

References

Linn, K. A., Laber, E. B., Stefanski, L. A. (2015) "iqLearn: Interactive Q-Learning in R", Journal of Statistical Software, 64(1), 1--25.

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

See Also

learnIQ2, summary.learnIQ1main, plot.learnIQ1main

Examples

Run this code
# NOT RUN {
## load in two-stage BMI data
data (bmiData)
bmiData$A1[which (bmiData$A1=="MR")] = 1
bmiData$A1[which (bmiData$A1=="CD")] = -1
bmiData$A2[which (bmiData$A2=="MR")] = 1
bmiData$A2[which (bmiData$A2=="CD")] = -1
bmiData$A1 = as.numeric (bmiData$A1)
bmiData$A2 = as.numeric (bmiData$A2)
s1vars = bmiData[,1:4]
s2vars = bmiData[,c (1, 3, 5)]
a1 = bmiData[,7]
a2 = bmiData[,8]
## define response y to be the negative 12 month change in BMI from
## baseline 
y = -(bmiData[,6] - bmiData[,4])/bmiData[,4]
s2ints = c (2, 3)
## second-stage regression
fitIQ2 = learnIQ2 (y ~ gender + parent_BMI + month4_BMI +
  A2*(parent_BMI + month4_BMI), data=bmiData, "A2", c("parent_BMI",
                                  "month4_BMI"))
## model conditional expected value of main effect term
fitIQ1main = learnIQ1main (fitIQ2, s1vars, a1, c (1, 3))
fitIQ1main = learnIQ1main (~ gender + race + parent_BMI + baseline_BMI
  + A1*(gender + parent_BMI), data=bmiData, "A1", c ("gender",
                                "parent_BMI"), fitIQ2)
summary (fitIQ1main)
plot (fitIQ1main)
# }

Run the code above in your browser using DataLab