# NOT RUN {
# 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$month12BMI - bmiData$baselineBMI) /
bmiData$baselineBMI
# Constant propensity model
moPropen <- buildModelObj(model = ~1,
solver.method = 'glm',
solver.args = list('family'='binomial'),
predict.method = 'predict.glm',
predict.args = list(type='response'))
# Create modelObj object for main effect component
moMain <- buildModelObj(model = ~ gender + parentBMI + month4BMI,
solver.method = 'lm')
# }
# NOT RUN {
rwlRes <- rwl(moPropen = moPropen, moMain = moMain,
data = bmiData, reward = bmiData$y, txName = "A2",
regime = ~ parentBMI + month4BMI)
##Available methods
# Coefficients of the propensity score regression
coef(rwlRes)
# Description of method used to obtain object
DTRstep(rwlRes)
# Estimated value of the optimal treatment regime for training set
estimator(rwlRes)
# Value object returned by propensity score regression method
fitObject(rwlRes)
# Summary of optimization routine
optimObj(rwlRes)
# Estimated optimal treatment for training data
optTx(rwlRes)
# Estimated optimal treatment for new data
optTx(rwlRes, bmiData)
# Value object returned by outcome regression method
outcome(rwlRes)
# Plots if defined by propensity regression method
dev.new()
par(mfrow = c(2,4))
plot(rwlRes)
dev.new()
par(mfrow = c(2,4))
plot(rwlRes, suppress = TRUE)
# Value object returned by propensity score regression method
propen(rwlRes)
# Parameter estimates for decision function
regimeCoef(rwlRes)
# Residuals used on method
residuals(rwlRes)
# Show main results of method
show(rwlRes)
# Show summary results of method
summary(rwlRes)
# }
Run the code above in your browser using DataLab