set.seed(647)
data(snpRFexample)
result <- snpRFcv(trainx.autosome=autosome.snps,trainx.xchrom=xchrom.snps,
trainx.covar=covariates, trainy=phenotype)
with(result, plot(n.var, error.cv, log="x", type="o", lwd=2))
## The following can take a while to run, so if you really want to try
## it, copy and paste the code into R.
## Not run:
# result <- replicate(5,snpRFcv(trainx.autosome=autosome.snps,
# trainx.xchrom=xchrom.snps,
# trainx.covar=covariates, trainy=phenotype),
# simplify=FALSE)
# error.cv <- sapply(result, "[[", "error.cv")
# matplot(result[[1]]$n.var, cbind(rowMeans(error.cv), error.cv), type="l",
# lwd=c(2, rep(1, ncol(error.cv))), col=1, lty=1, log="x",
# xlab="Number of variables", ylab="CV Error")
# ## End(Not run)
Run the code above in your browser using DataLab