R/SISselection.R

SIS.selection<-function(X,Y,pred,scale=F){
  if (scale==T){
    X<-scale(X)
  }
  p=dim(X)[2]
  IndicesSIS <- rep(0,p)
  beta <- rep(0,p)
  for (jj in 1:p){
    beta[jj]<-abs(glm(Y~X[,jj],family = binomial)$coefficients[2])
  }
  IndicesSIS <- sort(beta,index=TRUE,decreasing = TRUE)$ix		
  Xc<-X[,IndicesSIS[1:pred]] 
  Xsis <- Xc
  return(Xsis)
}

Try the lsplsGlm package in your browser

Any scripts or data that you put into this service are public.

lsplsGlm documentation built on May 2, 2019, 12:36 p.m.