[R] step

Jari Oksanen jari.oksanen at oulu.fi
Wed Sep 1 14:14:32 CEST 2010


Gavin Simpson <gavin.simpson <at> ucl.ac.uk> writes:

> 
> On Fri, 2010-08-27 at 11:03 -0300, Silvano wrote:
> > Hi,
> > 
> > how can I change the significance level in test F to select 
> > variable in step command?
> > 
> > I used
> > 
> > step(model0, ~x1+x2+x3+x4, direction=c("forward"), test='F', 
> > alpha=.05)
> > 
> > but it does't work.
> 
> Well, there is no 'test' argument, nor 'alpha', in stats:::step so no
> wonder it doesn't work.
> 
> step() doesn't do F tests and my reading of ?step leads me to understand
> that it was never designed to. Despite it using add1/drop1 it only
> passes arguments to extractAIC and that is documented to do nothing with
> extra arguments.
> 
> You will need to do this manually using:
> 
> add1(...., test = "F")
> 
> and then it will quote a p-value and you can decide whether to
> include/exclude.

Well, actually step() does pass extra arguments to add1()/drop1() (read the
source, Gav!), and these do have 'test' argument and that will work. What was
left open in this query is how "it doesn't work". You should get tests if you
are analysing a kinf of object for which its add1()/drop1() method has a test.
However, standard add1()/drop1() methods is R (stats) do not have 'alpha'
argument. I know one non-base package where add1()/drop1() has that argument,
but it has no "F" test and 'alpha' has no effect on model choice. Anyway, in all
standard cases the tests are only informative and are not used for model choice.
The key question indeed is that in which way this doesn't work?

Cheers, Jari Oksanen



More information about the R-help mailing list