Ordinal predictor treated as continuous in multiple linear regression: testing deviation from linearity with SPSS I am running a multiple linear regression with a continuous DV and a number of independent variables, one of which is ordinal (three-levels).
I am trying to follow David J Pasta’s instructions to evaluate the opportunity of treating the ordinal variable as continuous: [support.sas.com/resources/papers/proceedings09/248-2009.pdf]
However, the actual example comes from SAS and I am unable to do the same thing with SPSS (which I am familiar with) or R (which I am learning to use).
He suggests entering both the categorical) and linear (continuous) version of the variable in the same model in order to test the deviation from linearity (I have pasted an excerpt from the paper at the end of the question)
However, when I enter both the categorical variable (coded as two dummy variables) and the linear variable in the model, SPSS drops either the linear variable or one of the dummy variables. The same thing happens if I code the categorical variable as three dummy variables.  I guess this is due to multicollinearity, but maybe I am just doing something silly and I am unaware of it..
“…Then for each variable you could include both the original (categorical) version and the linear version in the same model! Won't that be redundant? Yes, it will, and the linear version will show up with zero degrees of freedom and not statistical test of significance. The Type III statistical test of the categorical version will have one less degree of freedom than usual and it will be testing the deviation from linearity – whether the remaining K-2 df have statistically significant explanatory power. If the categorical version is statistically significant, that tells you there is a significant non-linear component and it makes sense to omit the linear version of the variable. If the categorical version is not statistically significant by whatever criterion you shoose to use, that means that the linear component carries the explanatory power and the categorical variable can be dropped. (Of course, there's no guarantee that the linear version will be significant after dropping the categorical variable – that still needs to be tested.)”
Thanks for any help!
 A: This is a classic full-model/reduced model F test.

*

*Fit the model with the dummies (no linear term but all other covariates); this is the "full model." Get the residual sum of squares; call it $SS_f$.


*Fit the reduced model with only the linear term (and all other covariates); this is the "reduced model." Get the residual sum of squares; call it $SS_r$.
The reduced model is a linear restriction of the full model, so the $F$ test applies.


*Calculate $$ F = \frac{(SS_r - SS_f)/1}{(SS_f/\nu_f)},$$ where $\nu_f$ is the error degrees of freedom for the full model.  This statistic has the $F_{1,\nu_f}$ distribution under the null hypothesis of a perfectly linear trend, under the usual regression assumptions.


*Reject the null hypothesis of linearity if $F > F_{1-\alpha, 1, \nu_f}$.
The reason for the numerator df of 1 is that there is one additional parameter in the dummy variable model.
A: Thank you so much for your perfectly clear answer (which I hadn't seen yesterday)
I  have done the calculation by hand and the F statistic is non-significant. I then found  that R has something called Wald’s test for nested models which does the same thing automatically when I input a model with the linear version only and a model with the linear version plus the categorical variables (no problems with variables being kicked out of the model in this case). So, as far as I can see, the “manual” way is the easiest way to do what Pasta suggests in SPSS (apparently no Wald's test for linear regression available there).
If you can still bear with me I have two (possibly stupid) questions to make before I am sure I have understood everything correctly:
a) Would I be allowed to say something like “the ordinal predictor was treated as continuous (and not categorical) in the linear regression based on the non-significance of Wald’s test” ? Or should I be more specific? Like “based on the non-significance of Wald’s test comparing the categorical versus continuous predictor model”? Or something else?
b) The fact that the F statistic is non-significant is telling me that the model treating the ordinal predictor as  a  categorical variable is not a better fit for the data than the model treating it as continuous one (which is the one I am actually using). The assumption of linearity of the regression (which I usually check with a ZRES vs ZPRED plot) is another thing? Or isn’t it?
PS: I apologize for posting this as an answer and not as a comment but the word limit was too strict. Of course, I am willing to edit/delete anything you feel is not appropriate for the forum.
