[R] Odd behaviour of step (and stepAIC)?

Peter Dalgaard p.dalgaard at biostat.ku.dk
Fri Mar 19 17:19:49 CET 2004


"Anon." <bob.ohara at helsinki.fi> writes:

> I can only assume I'm betraying my ignorance here, but this is not
> what I would expect.
> 
> I'm getting the following from a stepwise selection (with both step
> and stepAIC):
> 
>  > step(lm(sqrt(Grids)~ SE + Edge + NH), scope=~ (Edge + SE + NH)^2)
> Start:  AIC= 593.56
>   sqrt(Grids) ~ SE + Edge + NH
> 
>            Df Sum of Sq    RSS    AIC
> <none>                 2147.0  593.6
> + Edge:NH  1       3.0 2143.9  595.1
> + SE:NH    4      23.2 2123.8  598.4
> - NH       1      75.8 2222.8  601.6
> - Edge     1     448.7 2595.7  646.4
> - SE       4    1033.7 3180.6  699.1
> 
> 
> My problem is that the SE:Edge term is not added.  Now, I know that
> I've specified the terms in a different order in the start model and
> the scope, but this shouldn't matter, should it?  Aren't these model
> specifications commutative?
> 
> Am I missing something important, or is this just an obscure feature?

Looks a bit odd, but the first thing I would do is to check whether
the model with that term added actually makes sense:

m1 <- lm(sqrt(Grids)~ SE + Edge + NH)
m2 <- update(m1,~.+SE:Edge)
anova(m1,m2)

My hunch is that you'l find zero DF between the two models, but try it
and see.

-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)             FAX: (+45) 35327907




More information about the R-help mailing list