[R] glm step() fkt

R. Michael Weylandt michael.weylandt at gmail.com
Wed Nov 30 15:31:51 CET 2011


Put them in a list:

ModelList <- vector("list", 100)
....
   ModelList[[i]] <- mod.step <- step(mod, direction="both",trace=T)

Then come back and use sapply() to do whatever you want to the set of
models to compare/count/etc them

Michael


On Wed, Nov 30, 2011 at 6:12 AM, Schrabauke <berndii at yahoo.de> wrote:
> Hi volks,
>
> i have a question about the step() fkt. Is there a possibility to save the
> last model generated from this method. I have a loop and so i generate 100
> different models with the step fkt and i want to know which model is the
> most common.
>
> CODE:
> ...
> missStep -> numeric(100)
> for (j in 1:100) {
>    trainindex <- sample(c(1:462),300)
>    train <- data[trainindex,]
>    test <- data[-trainindex,]
>    mod.step <- step(mod, direction="both",trace=T)
>                     }
> ...
>
> So i want to store each iteration the best model.
> Thx in advanced people,
> greetings
>
>
> --
> View this message in context: http://r.789695.n4.nabble.com/glm-step-fkt-tp4122588p4122588.html
> Sent from the R help mailing list archive at Nabble.com.
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



More information about the R-help mailing list