Displaying 1 result from an estimated 1 matches for "cv1glm".
Did you mean:
cpglm
2007 May 11
1
model seleciton by leave-one-out cross-validation
...omb
## input: vec -- vector
## output: all possible combination from the elements of vec
####################
rec.comb=function(vec)
{
if(length(vec)==0){list(NULL)
}else { tmp=rec.comb(vec[-1])
tmp2=sapply(tmp,function(x)c(vec[1],x))
c(tmp,tmp2)
}
}
####################
## function: CV1glm--CV1 using K fold CV
## input: y -- response vector; x -- predictors without intercept
## output: the vector whether each predictor should be selected. E.g.
(0,1,0,1) means no intecept while var1 and var3 should be selected
####################
CV1glm=function(y,x){
n.var=ncol(x)
n=nrow(x)
comb...