# [R] ordered and unordered variables

David Winsemius dwinsemius at comcast.net
Tue May 21 14:55:18 CEST 2013

```On May 20, 2013, at 10:35 PM, meng wrote:

> Hi all:
> If the explainary variables are ordinal,the result of regression is different from
> "unordered variables".But I can't understand the result of regression from "ordered
> variable".
>
> The data is warpbreaks,which belongs to R.
>
> If I use the "unordered variable"(tension):Levels: L M H
> The result is easy to understand:
>    Estimate Std. Error t value Pr(>|t|)
> (Intercept)    36.39       2.80  12.995  < 2e-16 ***
> tensionM      -10.00       3.96  -2.525 0.014717 *
> tensionH      -14.72       3.96  -3.718 0.000501 ***
>
> If I use the "ordered variable"(tension):Levels: L < M < H
> I don't know how to explain the result:
>           Estimate Std. Error t value Pr(>|t|)
> (Intercept)   28.148      1.617  17.410  < 2e-16 ***
> tension.L    -10.410      2.800  -3.718 0.000501 ***
> tension.Q      2.155      2.800   0.769 0.445182
>
> What's "tension.L" and "tension.Q" stands for?And how to explain the result then?

Ordered factors are handled by the R regression mechanism with orthogonal polynomial contrasts: ".L" for linear and ".Q" for quadratic. If the term had 4 levels there would also have been a ".C" (cubic) term. Treatment contrasts are used for unordered factors. Generally one would want to do predictions for explanations of the results. Trying to explain the individual coefficient values from polynomial contrasts is similar to and just as unproductive as trying to explain the individual coefficients involving interaction terms.

--

David Winsemius
Alameda, CA, USA

```