[R-sig-ME] lmer() using factor() vs ordered() predictors

Ken Knoblauch ken.knoblauch at inserm.fr
Tue Aug 30 14:53:46 CEST 2011


Mike Lawrence <Mike.Lawrence at ...> writes:
> I have some code and data posted to a gist
> (https://gist.github.com/1180476) where I encounter a scenario beyond
> my limited expertise. Specifically, I find that lmer() throws an error
> when I attempt to fit a rather complex model, but when I attempt to
> fit an analogous model after applying the ordered() function to each
> of my predictors, lmer() converges fine. Thinking that maybe ordered()
> dramatically changes how lmer handles the predictors, I compared the
> likelihood ratios computed for both types of data for a variety of
> less complex effects, and to my surprise I find that applying
> ordered() to the predictors does not appear to affect subsequently
> computed likelihood ratios. Does anyone have any input on these
> seeming discrepant results (i.e. ordered()ness of predictors can
> affect the convergence of a very complicated model but not the
> likeliood ratios associated with lower-order effects)?

A few preliminary observerations about your data set:
table(a$id)

10116 10144 10147 10157 10199 10280 10757 10775 11008 11010 
   74    89    83    79    87    82    63     

10775 11008 11010 
  2    89    43

You only have 2 observations for id = 10775.

Also, if you look at the distribution of the data, rt tends to be 
skewed:

histogram(~ rt | id, a)

I tried fitting a saturated model with lm and MASS:::boxcox
showed that the confidence interval contained 0, suggesting a 
log transformation.  If there was a Gamma or lognormal
link, I would recommend using glmer with them, but there
is not, yet.  

Taking that on board and even setting verbose = TRUE, I still
get an error:

lmer(LogRT ~ (1 | id) + arrow * tone * flanker * sstroop * 
      target *  location, data = a1, verbose = TRUE)
Error in mer_finalize(ans) : Downdated X'X is not positive definite, 89.

You have 2^5 * 3 = 96 terms in the formula but no observer 
performed all conditions.  Perhaps, a simpler model would
help or more data?

Making the variables ordered would cause contr.poly to be 
used instead of contr.treatment so that the coefficients
will be for terms of orthogonal polynomials. All of your
factors but 1 have only 2 levels, so I'm not sure what that
gets you or why it makes a difference here. Someone else
will certainly have more insight into this.

Hope that is useful.

best,

Ken




More information about the R-sig-mixed-models mailing list