# Are the posthoc results of the Linear Mixed Effect model valid?

by SamR   Last Updated September 11, 2019 00:19 AM

I'm running a Linear mixed model on a dataframe that consists of 3 variables: ID (n=11), region (n=3) and distance. The lme and posthoc analysis works for comparing whether there is a difference in distances between regions.
(lmod <-lme(distance~region, data = dat, random=~1|ID).This works fine.

However, when i want to compare whether there is a difference in distances between ID's for a single region, I get the message: Warning message: In qt((1 - level)/adiv, df) : NaNs produced.

Example:

``````lmod <-lme(distance~ID, data = dat, random=~1|region)

Linear mixed-effects model fit by REML
Data: anova
AIC      BIC    logLik
238.3404 250.7031 -113.1702

Random effects:
Formula: ~1 | region
(Intercept) Residual
StdDev:    0.525893 1.552832

Fixed effects: distance ~ ID
Value Std.Error DF  t-value p-value
(Intercept) 1.3707517 0.7195083 58 1.905123  0.0617
IDRTBC97    1.5807197 0.5966171 58 2.649471  0.0104
IDRTBC98    1.4744081 0.5966171 58 2.471280  0.0164
IDRTBC99    0.7074731 0.6944476 58 1.018757  0.3125
Correlation:
(Intr) IDRTBC97 IDRTBC98
IDRTBC97 -0.562
IDRTBC98 -0.562  0.677
IDRTBC99 -0.483  0.582    0.582

Standardized Within-Group Residuals:
Min         Q1        Med         Q3        Max
-1.7259489 -0.7290054 -0.1385774  0.7271977  2.5181760

Number of Observations: 62
Number of Groups: 1
Posthoc: emmeans(lmod, list(pairwise ~ ID), adjust = "tukey")

\$`emmeans of ID`

ID     emmean    SE df lower.CL upper.CL
RTBC96   1.37 0.720  0      NaN      NaN
RTBC97   2.95 0.626  0      NaN      NaN
RTBC98   2.85 0.626  0      NaN      NaN
RTBC99   2.08 0.720  0      NaN      NaN

d.f. method: containment
Confidence level used: 0.95

\$`pairwise differences of ID`
contrast        estimate    SE df t.ratio p.value
RTBC96 - RTBC97   -1.581 0.597 58 -2.649  0.0495
RTBC96 - RTBC98   -1.474 0.597 58 -2.471  0.0753
RTBC96 - RTBC99   -0.707 0.694 58 -1.019  0.7392
RTBC97 - RTBC98    0.106 0.479 58  0.222  0.9961
RTBC97 - RTBC99    0.873 0.597 58  1.464  0.4658
RTBC98 - RTBC99    0.767 0.597 58  1.285  0.5758

P value adjustment: tukey method for comparing a family of 4 estimates

Warning message:
In qt((1 - level)/adiv, df) : NaNs produced
``````

As far as i understand, I'm getting the warning message since i only have one group and the degrees of freedom are zero. However, I'm still getting the comparison between the ID's.

My question is: Can i use the p values of the pairwise differences of ID generated here, or are these invalid?