# Use the ovarian cancer data
data(Xdata, package="CGEN")
# Add some fake SNPs
set.seed(636)
Xdata[, "rs123"] <- rbinom(nrow(Xdata), 1, 0.4)
Xdata[, "rs456"] <- rbinom(nrow(Xdata), 1, 0.4)
Xdata[, "rs789"] <- rbinom(nrow(Xdata), 1, 0.4)
snpVars <- c("BRCA.status", "rs123", "rs456", "rs789")
objects <- list()
for (i in 1:length(snpVars)) {
fit <- snp.logistic(Xdata, "case.control", snpVars[i],
main.vars=c("oral.years", "n.children"),
int.vars=c("oral.years", "n.children"),
strata.var="ethnic.group")
# Compute the effects
objects[[i]] <- snp.effects(fit, "oral.years", var.levels=0:4)
}
# Plot
snp.effects.plot(objects)
# Plot all on the same scale
#snp.effects.plot(objects, op=list(ylim=c(0.9, 1.4), legend=list(x="bottom")))
# Plot all the joint effects of rs789 for the CML method and add confidence intervals
#snp.effects.plot(objects[[4]], op=list(method="CML", type="JointEffects",
# legend=list(x="bottomleft", inset=0), ylim=c(0.45, 1.3),
# colors=c("blue", "aquamarine", "skyblue"), addCI=1))
Run the code above in your browser using DataLab