[R] How do I get a a p-value for the output of an lme model with lme4?

Maria Sol Lago sollago at umd.edu
Thu Jul 25 18:00:55 CEST 2013


Hi there,

I just started using lme4 and I have a question about obtaining p-values. I'm trying to get p-values for the output of a linear mixed-effects model. In my experiment  I have a 2 by 2 within subjects design, fully crossing two factors, "Gram" and "Number". This is the command I used to run the model:

    >m <- lmer(RT ~ Gram*Number + (1|Subject) + (0+Gram+Number|Subject) + (1|Item_number),data= data)
    
If I understand this code, I am getting coefficients for the two fixed effects (Gram and Number) and their interaction, and I am fitting a model that has by-subject intercepts and slopes for the two fixed effects, and a by-item intercept for them. Following Barr et al. (2013), I thought that this code gets rid of the correlation parameters. I don't want estimate the correlations because I want to get the p-values using pvals.fnc (), and I read that this function doesn't work if there are correlations in the model.

The command seems to work:

    >m
    Linear mixed model fit by REML 
    Formula: RT ~ Gram * Number + (1 | Subject) + (0 + Gram + Number | Subject) + (1 |Item_number) 
       Data: mverb[mverb$Region == "06v1", ] 
       AIC   BIC logLik deviance REMLdev
     20134 20204 -10054    20138   20108
    Random effects:
     Groups      Name        Variance  Std.Dev. Corr          
    Item_number (Intercept)   273.508  16.5381               
     Subject     Gramgram        0.000   0.0000               
                 Gramungram   3717.213  60.9689    NaN        
                 Number1        59.361   7.7046    NaN -1.000 
     Subject     (Intercept) 14075.240 118.6391               
     Residual                35758.311 189.0987               
    Number of obs: 1502, groups: Item_number, 48; Subject, 32

    Fixed effects:
                 Estimate Std. Error t value
    (Intercept)    402.520     22.321  18.033
    Gram1          -57.788     14.545  -3.973
    Number1         -4.191      9.858  -0.425
    Gram1:Number1   15.693     19.527   0.804

    Correlation of Fixed Effects:
                (Intr) Gram1  Numbr1
    Gram1       -0.181              
    Number1     -0.034  0.104       
    Gram1:Nmbr1  0.000 -0.002 -0.011

However, when I try to calculate the p-values I still get an error message:
    
    >pvals.fnc(m, withMCMC=T)$fixed
    Error in pvals.fnc(m, withMCMC = T) : 
    MCMC sampling is not implemented in recent versions of lme4
      for models with random correlation parameters

Am I making a mistake when I specify my model? Shouldn't pvals.fnc() work if I removed the correlations?

Thanks for your help!

--Sol


More information about the R-help mailing list