I'm using linear mixed effects regression in R. I have a picture naming study with reaction time as the DV. I'm interested in the effect of an item's ordinal position, which is defined by the number of items that have already been named from that semantic category (e.g. Ordinal position 3 is the third item from that semantic category). There are two such fixed effects with this definition (differing based on item novelty). One has 3 levels, the other 4. I've defined them as factors in my lmer model. Doing so gives me different results than when I don't define them as factors. I consider them categorical variables, thus designating them as factors in my model, but with different results for each I'd like to be sure.

In other words, I'm interested in my DV (naming latency) from one ordinal position to the next (0:2 or 0:3, depending on predictor). An item's ordinal position is defined by how many semantically-related words have preceded it in the current cycle.

Edit for requested clarification: the question is whether the predictors described above (ordinal positions) would be appropriately classified as factors, rather than allowing R to treat them as continuous.


1 Answer 1


If they are numeric in the data and you don't define them as factors then R will treat them as continuous variables which is not what you want and will give meaningless results.

  • $\begingroup$ Additionally, notice that the degrees-of-freedom for the numerate for each effect is different, with only 1 df when treated as numeric (not as a factor) and j-1 when treated as a factor with j equal to the number of categories. Also note that both model treat the variable/factor as fixed, justed in different ways. $\endgroup$
    – dbwilson
    Sep 7, 2018 at 11:56
  • 1
    $\begingroup$ @PeterFlom, it wasn’t clear, at least to me, if the predictors in question are ordinal. In this case, I think it could make sense to check if the ordered categories have a linear relationship (or quadratic or cubic). This is at least what contr.poly() is doing in R for ordered factors. $\endgroup$ Sep 7, 2018 at 14:10
  • $\begingroup$ @DimitrisRizopoulos, the predictors are ordinal. A case might be made for them being interval, though I hesitate on that for lack of equally spaced intervals among items. I'm not familiar with the function you've mentioned, though maybe I should note that the predictors aren't designated as ordered factors. The trend across levels is expected to show a linear increase in the DV (reaction times), but the nature of the predictors (ordinal position) is such that half an ordinal position would not make sense, it is discrete. Please let me know if I've missed your point. $\endgroup$
    – S.Faw
    Sep 8, 2018 at 2:33
  • 1
    $\begingroup$ @S.Faw when you define a factor as an ordered factor, R uses orthogonal polynomial contrasts. The idea is to see if you can take advantage of the ordering of the categories & spend less parameters than if you treat it as an ordinary factor. By default you for $K$ levels you get a $K-1$ polynomial that provides the same fit as treating as an ordinary factor. But looking at the coefficients, you can for example see that only the linear coefficient is significant and the remaining not. Then the you can re-fit the model assuming a linear relationship and spend only one parameter. $\endgroup$ Sep 8, 2018 at 8:25
  • $\begingroup$ @DimitrisRizopoulos thank you. It sounds like this is something I'll need to learn more about. I am interested in whether or not there is a linear increase in naming latency across ordinal position. However, I must not be using contr.poly() correctly, as I get an error in return saying that it cannot accurately calculate for 1852 degrees of freedom (the total number of observations in my data set). If you have any additional thoughts on this I would be grateful for them, but I will certainly need to understand the fundamentals better. $\endgroup$
    – S.Faw
    Sep 10, 2018 at 16:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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