# Use the ovarian cancer data
data(Xdata, package="CGEN")
# Fake principal component columns
set.seed(123)
Ydata <- cbind(Xdata, PC1=rnorm(nrow(Xdata)), PC2=rnorm(nrow(Xdata)))
# Match using PC1 and PC2
mx <- getMatchedSets(Ydata, CC=TRUE, NN=TRUE, ccs.var="case.control",
dist.vars=c("PC1","PC2"), size = 4)
# Append columns for CC and NN matching to the data
Zdata <- cbind(Ydata, CCStrat=mx$CC, NNStrat=mx$NN)
# Fit using variable names
ret1 <- snp.matched(Zdata, "case.control",
snp.vars = "BRCA.status",
main.vars=c("oral.years", "n.children"),
int.vars=c("oral.years", "n.children"),
cc.var="CCStrat", nn.var="NNStrat")
# Compute a Wald test for the main effect of BRCA.status and its interactions
getWaldTest(ret1, c("BRCA.status", "BRCA.status:oral.years", "BRCA.status:n.children"))
# Fit the same model as above using formulas.
ret2 <- snp.matched(Zdata, "case.control", snp.vars = ~ BRCA.status,
main.vars=~oral.years + n.children,
int.vars=~oral.years + n.children,
cc.var="CCStrat",nn.var="NNStrat")
# Compute a summary table for the models
getSummary(ret2)
Run the code above in your browser using DataLab