# Interpreting lme4 fixed effects using pamer.fnc from LMERConvenienceFunctions package in R

I'm fitting multi-level models in R using both lme from nlme package and lmer from lme4. It is a very simple model.

Using lme: lmeModel <- lme(Flourish ~ Week * condition, random = ~ Week|id, na.action = na.exclude)

Using lmer: lmerModel <- lmer(Flourish ~ Week * condition + (Week | id), na.action = na.exclude)

For each fixed effect, I get the same t-values, regardless of whether I use lme or lmer. Here's one of the fixed effects:

summary(lmeModel) #using nlme
Fixed effects: Flourish ~ Week * condition
Value Std.Error  DF  t-value p-value
Week 0.00570 0.1728345 569  0.03297  0.9737

summary(lmerModel) #using lme4
Fixed effects:
Estimate Std. Error t value
Week 0.005698   0.172834    0.03


Someone has suggested that I use the pamer.fnc function from the LMERConvenienceFunctions package to run an ANOVA on my lmerModel to get the p values. Here is a section of the output for the same fixed effect:

pamer.fnc(lmerModel)
Df  Sum Sq Mean Sq F value upper.p.val lower.p.val expl.dev.(%)
Week    1 49.7262 49.7262  5.0849      0.0244      0.0246       0.1043


Can anyone explain why the t-value of the fixed effect 0.03 (p = 0.97), which is not significant at all, but the F-value of the same fixed effect is 5.08 (p ≈ 0.02), which is significant? I really appreciate any help anyone can provide. Thanks a lot!

• this is an interesting question, but hard to answer without a reproducible example. (1) in general the F-statistic for a case with 1 denominator df should always be $t^2$, so I don't see where this F-value of 5.08 is coming from ... (2) lme is probably getting the denominator df for this random-slopes model wrong (but it might not make that big a difference (3) you can use the lmerTest package to get Satterthwaite or Kenward-Roger approximations for the p value ... – Ben Bolker Jul 17 '15 at 0:54
• Thanks a lot for your response. I've just tried the lmerTest package and it reports the same p-values as the lmeModel, which means lme hasn't really got it wrong. I'm thinking the different p-value provided by pamer.fnc might be because it is related to F ratio, not t value. F ratios and their p-values are about variance explained, whereas t values and their p-values are testing whether the slope (beta values) differ significantly from 0. This is just my guess, so I'm not sure whether this explains the huge discrepancy in p-values. – hsl Jul 17 '15 at 1:28
• I strongly suspect that pamer.fnc is doing something bogus but really can't tell without a reproducible example ... – Ben Bolker Jul 17 '15 at 1:37
• So I shouldn't trust pamer.fnc and should just rely on the p-values provided by lme or lmerTest? It's difficult to provide a reproducible example, but I've uploaded the data here. – hsl Jul 17 '15 at 2:01