Angelo Passalacqua
2008-Feb-21 14:25 UTC
[R] overall comparison of an ordered categorical in a multiple regression
I entered the following: formula<-nst~age+soc+inc+reg+imp pnstlm<-lm(formula,nst) summary(pnstlm) imp and soc are ordered categorical variables but the summary does not give an output of the overall p-values, just individual comparisons. I can't find help for this in the manual. Is there a command or option change in the summary to find out the overall p-value? thank you in advance [[alternative HTML version deleted]]
Gavin Simpson
2008-Feb-21 14:52 UTC
[R] overall comparison of an ordered categorical in a multiple regression
On Thu, 2008-02-21 at 14:25 +0000, Angelo Passalacqua wrote:> I entered the following: > > formula<-nst~age+soc+inc+reg+imp > > pnstlm<-lm(formula,nst) > > summary(pnstlm) > > imp and soc are ordered categorical variables but the summary does not give > an output of the overall p-values, just individual comparisons. I can't > find help for this in the manual. Is there a command or option change in > the summary to find out the overall p-value?I think you want: anova(pnstlm) to get single measures for imp and soc 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 %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
David Winsemius
2008-Feb-21 15:17 UTC
[R] overall comparison of an ordered categorical in a multiple regression
"Angelo Passalacqua" <apassala at gmail.com> wrote in news:d484d1550802210625i6b49868ct325d5623c6e6c9f2 at mail.gmail.com:> I entered the following: > > formula<-nst~age+soc+inc+reg+imp > > pnstlm<-lm(formula,nst) > > summary(pnstlm) > > imp and soc are ordered categorical variables but the summary does > not give an output of the overall p-values, just individual > comparisons. I can't find help for this in the manual. Is there a > command or option change in the summary to find out the overall > p-value?Simpson's suggestion is far simpler than my solution, and probably answers your question more accurately, but here is another way of looking at regression with ordered independent variables: If the levels of the factor are ordered as you expect them (and even if the factor is not of class "ordered factor"), rather than some default alpha ordering, then you could try: pnstlm2 <- lm(nst ~ age + as.numeric(soc) + inc + reg + as.numeric(imp), data=nst) They won't be centered, but in this simple model, that will only change the intercept. The coefficients will be the change in nst$nst per single factor increase in "soc" or "imp". The difference in deviance between your first model and the one you have now will be a test of joint linearity of "imp" and "soc" in relation to "nst". (You probably want to construct them individually.) (Personally, I think it is a bad practice to create a variable with the same name as a dataframe.) -- David Winsemius