Re: [R] overall comparison of an ordered categorical in a multiple regression

From: David Winsemius <dwinsemius_at_comcast.net>
Date: Thu, 21 Feb 2008 15:17:21 +0000 (UTC)

"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

______________________________________________
R-help_at_r-project.org 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.
Received on Thu 21 Feb 2008 - 15:20:13 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 21 Feb 2008 - 15:30:16 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive