Quantcast

step

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

step

Silvano-7
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.

--------------------------------------
Silvano Cesar da Costa
Departamento de Estatística
Universidade Estadual de Londrina
Fone: 3371-4346

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: step

Gavin Simpson
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.

Or use step() and use AIC (or BIC) for model selection. Or perhaps
instead try the lasso or ridge regression... See the machine learning
task view for details of those:

http://cran.r-project.org/web/views/MachineLearning.html

HTH

G
--
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
 Dr. Gavin Simpson             [t] +44 (0)20 7679 0522
 ECRC, UCL Geography,          [f] +44 (0)20 7679 0565
 Pearson Building,             [e] gavin.simpsonATNOSPAMucl.ac.uk
 Gower Street, London          [w] http://www.ucl.ac.uk/~ucfagls/
 UK. WC1E 6BT.                 [w] http://www.freshwaters.org.uk
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: step

Jari Oksanen
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

______________________________________________
[hidden email] 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.
Loading...