1
$\begingroup$

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!

$\endgroup$
12
  • $\begingroup$ 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. $\endgroup$ Commented Jun 20, 2021 at 14:16
  • $\begingroup$ 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? $\endgroup$
    – paola
    Commented Jun 20, 2021 at 16:30
  • $\begingroup$ 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.) $\endgroup$ Commented Jun 20, 2021 at 17:11
  • $\begingroup$ 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? $\endgroup$
    – paola
    Commented Jun 20, 2021 at 18:32
  • $\begingroup$ You cannot test what you want to if there is perfect multicollinearity. If Pasta thinks you can, he probably got that wrong. $\endgroup$ Commented Jun 20, 2021 at 18:34

2 Answers 2

0
$\begingroup$

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.

$\endgroup$
1
  • $\begingroup$ Dear @BigBendRegion, I have posted my comment as an answer. $\endgroup$
    – paola
    Commented Jun 21, 2021 at 18:24
0
$\begingroup$

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.

$\endgroup$
1
  • $\begingroup$ (a) Looks ok. I might say "deviations from linearity are explainable by chance alone, based on the Wald test..." or something like that. (b) The ordinal model is not a discernably better fit. As far as the linearity assumption, it refers to the entire model, but this test is just a part of all that. So this is a test for linearity with respect to this particular X. $\endgroup$ Commented Jun 22, 2021 at 0:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.