10
$\begingroup$

I am analyzing the eye-tracking data from a designed experiment. A simplified version of my data looks like this (You can get the dput() data here),

head(lookDATA)

  participant fixationImage fixationCount
1           9    Automobile            81
2           9          Bird            63
3           9         Chair            82
4           9           Dog            64
5           9          Face            90
6           9         Plant            75

where participant is a unique identifier for each subject, fixationImage is what picture category they fixated on, and fixationCount is the number of times they fixated on that picture category.

I fit a poisson model to the data using glmer() from the lme4 package.

model<-glmer(fixationCount ~ fixationImage + (1|participant), family = poisson, data = lookDATA)

I used lsmeans() from the lsmeans package to examine the differences among the factor levels,

cld(lsmeans(model,"fixationImage"))

which provides the following output:

fixationImage   lsmean         SE df asymp.LCL asymp.UCL .group
Chair         3.786022 0.05764923 NA  3.673018  3.899026  1    
Bird          3.866201 0.05750641 NA  3.753476  3.978925   2   
Dog           3.868768 0.05751010 NA  3.756037  3.981500   2   
Body          3.883644 0.06040952 NA  3.765230  4.002059   23  
Plant         3.893327 0.05746744 NA  3.780679  4.005975   23  
Automobile    3.901939 0.05745528 NA  3.789315  4.014563   23  
Face          3.946848 0.05832549 NA  3.832519  4.061178    3 

According to my (perhaps limited) understanding of the using lsmeans vignette the lsmean column should represent the average number of looks to a given category predicted by the model.

However, these values seem uncomfortably far from simple descriptive statistics for these numbers,

summaryBy(fixationCount ~ fixationImage, data = lookDATA)

  fixationImage fixationCount.mean
1    Automobile           55.18750
2          Bird           53.25000
3          Body           57.12821
4         Chair           50.39450
5           Dog           53.82883
6          Face           56.76389
7         Plant           54.71429

suggesting perhaps that I do not correctly understand what the lsmeans represent here, or perhaps that I've misspecified the model.

Any assistance would be greatly appreciated.

$\endgroup$
9
$\begingroup$

The output represents predictions from your model for each image. With the poison family, the default link function is the natural log - so those values are on the log scale. If you do lsmeans(..., type = "response"), it will back-transform the predictions to the original response scale.

$\endgroup$
  • $\begingroup$ Thanks so much for the swift answer. I changed my syntax to cld(lsmeans(model,"fixationImage",type="response")) but got the following error: Error in $<-.data.frame(*tmp*, "sep", value = ",") : replacement has 1 row, data has 0. For the record I am using R version 3.1.2 (2014-10-31) 'Pumpkin Helmet' and lsmeans version 2.17. Nonetheless, you've answered my question and I will transform the output manually. Thanks again! $\endgroup$ – Marcus Morrisey Apr 26 '15 at 21:59
  • $\begingroup$ Update: Error persisted upon update to R version 3.2.0 (2015-04-16), "Full of Ingredients" $\endgroup$ – Marcus Morrisey Apr 26 '15 at 22:24
  • 2
    $\begingroup$ I'm not sure why the error occurs but it looks like it comes from the cld side of things. Take it out and see if it works. And use pairs instead of cld to test the comparisons (in a separate call). That's a better route anyway because cld makes black-and-white decisions. $\endgroup$ – Russ Lenth Apr 26 '15 at 22:59
  • $\begingroup$ Thanks again. You were correct, functions fine outside of cld(). I agree with your assessment about the superiority of pairs(). I plan to use the cld() output for plotting and include a table with the more detailed information from pairs() in the supplementary materials. Awesome package, keep up the great work. $\endgroup$ – Marcus Morrisey Apr 26 '15 at 23:12
  • 3
    $\begingroup$ @MarcusMorrisey I have fixed the bug in cld that created the error. Thanks for reporting it. Send me an e-mail (see Maintainer field) if you want me to send the updated package. Else it'll be updated on CRAN in a few weeks. $\endgroup$ – Russ Lenth Apr 27 '15 at 16:01

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.