[R] fitting of all possible models

Indermaur Lukas Lukas.Indermaur at eawag.ch
Tue Feb 27 17:04:59 CET 2007


Hi Frank
I fitted a set of 12 candidate models and evaluated the importance of variables based on model averaged coefficients and SE (model weights >=0.9). Variables in my models were not distributed in equal numbers across all models thus I was not able to evaluate the importance of variables just by summing up the AIC-weights of models including a specific variable. Now, why so many models to fit: I was curious, if the ranking in the importance of variables is similar, when just summing up the AIC-weights over an all-possible-models set and looking at the ordered model averaged coefficients (order of CV=SE/coefficient).
 
Any hint for me?
Cheers
Lukas

 

Indermaur Lukas wrote:
> Hi,
> Fitting all possible models (GLM) with 10 predictors will result in loads of (2^10 - 1) models. I want to do that in order to get the importance of variables (having an unbalanced variable design) by summing the up the AIC-weights of models including the same variable, for every variable separately. It's time consuming and annoying to define all possible models by hand.
> 
> Is there a command, or easy solution to let R define the set of all possible models itself? I defined models in the following way to process them with a batch job:
> 
> # e.g. model 1
> preference<- formula(Y~Lwd + N + Sex + YY)                                               
> # e.g. model 2
> preference_heterogeneity<- formula(Y~Ri + Lwd + N + Sex + YY) 
> etc.
> etc.
> 
> 
> I appreciate any hint
> Cheers
> Lukas

If you choose the model from amount 2^10 -1 having best AIC, that model
will be badly biased.  Why look at so many?  Pre-specification of
models, or fitting full models with penalization, or using data
reduction (masked to Y) may work better.

Frank

> 
> 
> 
> 
> 
> °°°
> Lukas Indermaur, PhD student
> eawag / Swiss Federal Institute of Aquatic Science and Technology
> ECO - Department of Aquatic Ecology
> Überlandstrasse 133
> CH-8600 Dübendorf
> Switzerland
> 
> Phone: +41 (0) 71 220 38 25
> Fax    : +41 (0) 44 823 53 15
> Email: lukas.indermaur at eawag.ch
> www.lukasindermaur.ch
>
> ______________________________________________
> R-help at stat.math.ethz.ch 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.
>


--
Frank E Harrell Jr   Professor and Chair           School of Medicine
                      Department of Biostatistics   Vanderbilt University



More information about the R-help mailing list