[R] model selection with step function

P Ehlers ehlers at math.ucalgary.ca
Fri Nov 25 01:51:56 CET 2005


Antonio Olinto wrote:

> Hello,
> 
> I have a doubt in using the function step (step wise) to select glm models.
> 
> Usually I apply the gamma distribution to analyze fishery data. To select the
> terms I use a routine where I first compare single term models to the null model
> (eg. U~1 vs. U~depth; U~1 vs. U~latitude; etc. – where U= abundance) and, by
> means of the result given by a likelihook function applied for each comparison,
> I select the “strongest” effect, let’s say depth. Then I run a new step
> comparing the U~depth vs. U~depth+latitude; U~depth vs. U~depth+... etc. Making
> this way I put the terms in “magnitude” order.
> 
> I tried to make a gaussian model using the step(glm.model) function to select
> the terms but I saw that in the output table given by anova(glm.model) the
> selected terms kept the original order.
> 
> Is it possible to have the terms in the model rearranged, as in my example?
> 
> Thanks for any help. I read Chambers and Hastie’s “Statistical Models in S”,
> Venables and Ripley “Modern Applied Statistics” and, of course, R help but I
> couldn’t get the trick.
> 

I don't know if this will get you there, but

1. I would use stepAIC in package MASS;
2. set argument trace = TRUE;
3. think very hard about the interpretation of the model;
4. read also Frank Harrell's "Regression Modeling Strategies".

Peter


> Antonio
> 
> --
> Biologist
> Sao Paulo Fisheries Institute
> 
> 
> 
> -------------------------------------------------
> WebMail Bignet - O seu provedor do litoral
> www.bignet.com.br
> 
> ______________________________________________
> 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

-- 
Peter Ehlers
Department of Mathematics and Statistics
University of Calgary, 2500 University Dr. NW       ph: 403-220-3936
Calgary, Alberta  T2N 1N4, CANADA                  fax: 403-282-5150




More information about the R-help mailing list