## Not run:
# # data1
# set.seed(1)
# n <- 100
# M <- 50
# X <- matrix(rnorm(n*M), ncol=M)
# snp <- 10*(1:5)
# y <- rowSums(X[, snp]) + rnorm(n)
#
# # you can use classical criteria to such type of data:
# fit <- selectModel(X, y, crit=aic)
# summary(fit)
# selectModel(X, y, crit=bic)
#
#
# # data2
# set.seed(1)
# n <- 1e3
# M <- 1e4
# X <- matrix(rnorm(M*n), ncol=M)
# snp <- 1e3*(1:10)
# y <- rowSums(X[, snp]) + rnorm(n, sd=2)
# Q <- matrix(rnorm(n*5), n, 5) # additional variables
#
# # single tests + multi-forward + multi-backward + stepwise using mBIC
# selectModel(X, y, p=M)
# selectModel(X, y, p=M, multif=FALSE) # only single tests + stepwise
# selectModel(X, y, p=M, multif=FALSE, minpv=1) # only stepwise
#
# # you can start with a model with variables in Q and force that
# # 1st and 5th would not be removed
# selectModel(X, y, Xm=Q, stay=c(1, 5), p=M, crit=mbic2)
#
# # after reducing the size of matrix X (removing variables with
# # p-value > minpv), save it to a file (you can use it in another
# # model selection, it will be faster)
# selectModel(X, y, p=M, file.out="Xshort")
#
# # you can define your own criterion
# # (you have to put 'rss', 'k' and 'n' in a list of parameters)
# myCrit <- function(rss, k, n, c1=2, c2=3) {
# c1*log(rss) + sqrt(k*c2)/5
# }
# selectModel(X, y, multif=FALSE, crit=myCrit, c1=1.5)
# selectModel(X, y, multif=FALSE,
# crit=function(rss, k, n) 1.4*log(rss) + sqrt(k*3)/5)
#
# selectModel(X, y, crit=bic) # bad idea...
#
#
# # data3
# X <- read.big.matrix("X.txt", sep=" ", type="char", head=TRUE)
# y <- read.table("Trait.txt")
# Q <- read.table("Q.txt")
# selectModel(X, y, p=M)
# selectModel(X, y, p=M, minpv=0.001) # if you do not have time...
# ## End(Not run)
Run the code above in your browser using DataLab