# 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!

• Sounds like perfect multicollinearity. Try a regression of the linear version of the variable on the dummies. If you get a perfect fit, then you know you have perfect multicolinearity. Jun 20, 2021 at 14:16
• Dear Richard, you are absolutely right. When I regress the linear version on the dummies (2 or 3 makes no difference) I get an R2 of 1. Does this automatically tell me that I am allowed to use the linear version without going through the steps suggested by RJ Pasta? Or is there something else I can do to follow his suggestion on how to test for deviations from linearity? Jun 20, 2021 at 16:30
• You should not have a set of explanatory variables that are perfectly multicollinear. Kick some out, and then you can continue along the lines suggested by Pasta. (I suppose he did not suggest including multicollinear variables.) Jun 20, 2021 at 17:11
• I am afraid he did... He says "won't that be redundant? Yes it will ..." . I understand that the whole point is using variables that are necessarily multicollinear (categorical and linear version of the same variable). If I remove some I can no longer test what he suggests. But I don't know what to do with perfect multicollinearity. Do you think finding perfect multicollinearity is already an answer to the question of whether I can treat the ordinal variable as continuous? Since the 2 versions of the variables seem to be "interchangeable" wouldn't they have the same explanatory power? Jun 20, 2021 at 18:32
• You cannot test what you want to if there is perfect multicollinearity. If Pasta thinks you can, he probably got that wrong. Jun 20, 2021 at 18:34

This is a classic full-model/reduced model F test.

1. 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$$.

2. 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.

1. 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.

2. 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.

• Dear @BigBendRegion, I have posted my comment as an answer. Jun 21, 2021 at 18:24