Commit 47f3e11c authored by levintow's avatar levintow
Browse files

adding code to compare models

parent cb18f18c
......@@ -70,7 +70,7 @@ ds.struct.1 = build_models(treat("idu", formula = idu~white+age+cd4),
outcome("Y"))
wihs1 = est.ipwrisk(a,ds.struct.1, times = seq(0,10,0.1),
label = c("wihs","Main Analysis"))
label = c("wihs1","Main Analysis"))
plot(wihs1) + theme_bw() + xlab("Follow-up time") + ylab("Risk of outcome")
plot(wihs1,rd = TRUE) + theme_bw() + ggtitle("Cumulative RD in WIHS data")
hist(wihs1) + theme_bw() + ggtitle("Propensity Score Distributions")
......@@ -83,7 +83,7 @@ ds.struct.2 = build_models(treat("idu", formula = idu~white+age+cd4),
outcome("Y"))
wihs2 = est.ipwrisk(a,ds.struct.2, times = seq(0,10,0.1),
label = c("wihs","Main Analysis with 2 Censoring Models"))
label = c("wihs2","Main Analysis with 2 Censoring Models"))
plot(wihs2) + theme_bw() + xlab("Follow-up time") + ylab("Risk of outcome")
plot(wihs2,rd = TRUE) + theme_bw() + ggtitle("Cumulative RD in WIHS data")
......@@ -94,9 +94,13 @@ kable(make_table2(wihs1, wihs2, index = 10), format="markdown")
## What happens if data structure does not specify predictors of treatment and censoring?
## Just want to look at crude results for comparison, using the package
ds.struct.3 = build_models(treat("idu", formula = idu~1),
cens("C1", formula = C1~1),
cens("C2", formula = C2~1),
cens("C1", formula = C1~strat(idu)),
cens("C2", formula = C2~strat(idu)),
outcome("Y", formula = Y~idu))
wihs3 = est.ipwrisk(a,ds.struct.3, times = seq(0,10,0.1),
label = c("wihs","Crude Analysis"))
## Not working - there is a warning about invalid model formula
label = c("wihs3","Crude Analysis"))
plot(wihs3) + theme_bw() + xlab("Follow-up time") + ylab("Risk of outcome")
plot(wihs3,rd = TRUE) + theme_bw() + ggtitle("Cumulative RD in WIHS data")
kable(make_table2(wihs1, wihs2, wihs3, index = 10), format="markdown")
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment