From: Dieter Menne <dieter.menne_at_menne-biomed.de>

Date: Fri 19 Aug 2005 - 19:50:33 EST

R-help@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 Received on Fri Aug 19 19:58:39 2005

Date: Fri 19 Aug 2005 - 19:50:33 EST

Lukasz Komsta <luke <at> novum.am.lublin.pl> writes:

> I need to compute zero of polynomial function fitted by lm. For example

*> if I fit cubic equation by fit=lm(y~x+I(x^2)+i(x^3)) I can do it simply
**> by polyroot(fit$coefficients). But, if I fit polynomial of higher order
**> and optimize it by stepAIC, I get of course some coefficients removed.
**> Then, if i have model
**>
**> y ~ I(x^2) + I(x^4)
**>
**> i cannot call polyroot in such way, because there is a need to call
**> polyroot(c(0,0,fit$coefficients[1],0,fit$coefficients[2]).
**>
**> Is there any method to do it automagically? I would like to write small
**> function solving polynomial optimized by stepAIC, regardless of missing
**> terms.
*

Are you really sure you want to throw away lower order terms in a fit by misusing stepAIC? With the rare exception of omitting a constant offset, I don't know any case where there are good reasons to omit lower order terms in a fit (willing to learn, though,...).

And if you only want to find the zeroes, it's definitively not useful to "optimize" this way. When factors are involved, stepAIC always keeps lower order terms, but it is expecting a bit too much from stepAIC to expect an "do you really want to do this" here.

For a more competent discussion of the matter, read Bill Venables

http://www.stats.ox.ac.uk/pub/MASS3/Exegeses.pdf

Dieter

R-help@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 Received on Fri Aug 19 19:58:39 2005

*
This archive was generated by hypermail 2.1.8
: Fri 03 Mar 2006 - 03:39:54 EST
*