[R] variable selection in R using bootstrapping

Yunda Huang yunda at ucla.edu
Tue Aug 21 00:17:36 CEST 2001


Hi, all:

Is there anyone know about the variable selection procedure in R using bootstrapping? I tried to define the statistics function as following to find the best set of covariates in each bootstrap resample. My plan was to construct the final model based on the common covariates picked from every R=300 resamples. 
 
dat3.pred.fun <- function( data, i, formula )

{ d <- data[i,]

  d.glm.all <- glm(formula,family=binomial,data=d )

  d.fit<-step(d.glm.all)

  formula(d.fit) 

# or summary(d.fit)$coefficient[,1]

# .....

}

 And then I called the boot function as: 

r_300  # no of bootstrap samples

dat3.boot <- boot( dat3, dat3.pred.fun, R=r,sim="ordinary", formula=formula(dat3.glm.help))

However, R gave me message like " terms. formula(X, ...): object "d" not found". Anyone has any clue about it? 

Thank you very much for your time!

Sincerely,

Yunda

Department of Biostatistics 

University of California, Los Angeles








-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://stat.ethz.ch/pipermail/r-help/attachments/20010820/8be2d322/attachment.html


More information about the R-help mailing list