IQ1 | R Documentation |
Recommends the IQ-estimated optimal first-stage treatment for a patient with observed stage 1 variables.
IQ1(mainObj, cmObj, sigObj, dens, h1main, h1cm, h1sig)
mainObj |
object of type |
cmObj |
object of type |
sigObj |
object of type |
dens |
method of density estimation, either "norm" for normal location-scale density estimate or "nonpar" for the empiricial density estimator |
h1main |
vector of observed first-stage main effects corresponding to the
variables in |
h1cm |
vector of observed first-stage main effects corresponding to the
variables in |
h1sig |
vector of observed first-stage main effects corresponding to the
variables in |
Use the estimated optimal first-stage decision rule from
learnIQ1()
to recommend the best stage 1 treatment for a
patient presenting with history h1
. It is essential
that h1main
include the same variables and ordering as
H1Main
. If a formula was used to fit learnIQ1main()
, we
recommend checking summary(<learnIQ1main object>)
for the correct order
of h2
. Similarly for h1cm
and h1sig
. dens
can be chosen by looking at a normal QQ-plot of the standardized residuals from the contrast mean and variance modeling steps.
q1Pos |
estimated value of the first-stage Q-function when H1=h1 and A1=1 |
q1Neg |
estimated value of the first-stage Q-function when H1=h1 and A1=-1 |
q1opt |
estimated optimal first-stage treatment for a patient presenting with h1 |
Kristin A. Linn <kalinn@ncsu.edu>, Eric B. Laber, Leonard A. Stefanski
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.
learnIQ1main
, learnIQ1cm
, learnIQ1var
,
## 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] ## second-stage regression fitIQ2 = learnIQ2 (y ~ gender + parent_BMI + month4_BMI + A2*(parent_BMI + month4_BMI), data=bmiData, "A2", c("parent_BMI", "month4_BMI")) summary (fitIQ2) ## model conditional expected value of main effect term fitIQ1main = learnIQ1main (~ gender + race + parent_BMI + baseline_BMI + A1*(gender + parent_BMI), data=bmiData, "A1", c ("gender", "parent_BMI"), fitIQ2) ## model conditional mean of contrast function fitIQ1cm = learnIQ1cm (~ gender + race + parent_BMI + baseline_BMI + A1*(gender + parent_BMI + baseline_BMI), data=bmiData, "A1", c ("gender", "parent_BMI", "baseline_BMI"), fitIQ2) ## variance modeling fitIQ1var = learnIQ1var (~ gender + race + parent_BMI + baseline_BMI + A1*(parent_BMI), data=bmiData, "A1", c ("parent_BMI"), "hetero", fitIQ1cm) ## new patient h1 = c (1, 1, 30, 35) optIQ1 = IQ1 (fitIQ1main, fitIQ1cm, fitIQ1var, "nonpar", h1, h1, h1) optIQ1$q1opt
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.