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

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

"Angelo Passalacqua" <> wrote in

> 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

______________________________________________ mailing list
PLEASE do read the posting guide
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 Please read the posting guide before posting to the list.

list of date sections of archive