[R] Multiple regression script

GlenB glnbrntt at gmail.com
Tue Dec 8 02:52:51 CET 2009



Joel Fürstenberg-Hägg said:
"Multiple linear regression [...] I would like to check every possible
combination of factors, evalute the results based for instance on their p
values, and then choose the best regression model."

By "every possible combination of factors", I assume you mean that for k
factors, you want
to consider all 2^k models where each factor is either present in the model
or absent from it
as a main effect, (or do you mean to include interactions as well?),
selected by p-value?

Speaking from a statistical practice point of view, this is probably not a
good idea.

If you really want to do a "best subset" type regression, there's the
package bestglm at CRAN.
http://cran.r-project.org/web/packages/bestglm/index.html - it doesn't do it
by p-values
and if your factors have more than two levels it does it via complete
enumeration rather
than using something efficient like the leaps and bounds algorithm, but it's
close to the
sort of thing you want.

Doubtless there are other packages that also implement this sort of
exhaustive model selection.

-- 
View this message in context: http://n4.nabble.com/Multiple-regression-script-tp954567p954940.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list