[R] step
Gavin Simpson
gavin.simpson at ucl.ac.uk
Fri Aug 27 20:20:16 CEST 2010
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
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
More information about the R-help
mailing list