I have an unbalanced linear mixed effects model with three fixed factors of various levels and one random factor for my repeated measures data (for details see here).

Thanks to your help I managed to do post-hoc tests on the significant interaction terms using `lsm`

from the **lsmeans** package. However, I need to report the F statistic (F value and degrees of freedom) for these post-hoc tests and wonder how???

Here is what I do:

Model comparison using

`anova()`

resulting into the final model

`model_final`

, which reads:`sc ~ time + cond + place + time:cond + cond:place + (1|ID), data)`

.I analyze the significant interaction time:cond using

`lsmeans`

:`posthoc_1 <- glht(model_final, lsm(pairwise ~ cond|time)`

`summary(posthoc_1)`

and get sth like below for each level of `time`

, here is the example for `time1`

.

`> Note: df set to 268 > > $`time = time1` > > Simultaneous Tests for General Linear Hypotheses > > Fit: lme4::lmer(formula = sc ~ time + cond + place + time:cond + cond:place + (1|ID), data) > > Linear Hypotheses: > Estimate Std. Error t value Pr(>|t|) > cond1 - cond2 == 0 3.1867 0.6797 4.688 4.39e-06 *** `

This gives me t-values for the various levels of the interaction terms and their corresponding p-value, but no F stats!

My questions:

- Is there any way of obtaining the F stats? (F value and degree of

freedom) - Or am I stuck with the t-values? If so, is t(0.095;268) =

4.588, p < 0.001 reporting the correct degrees of freedom?

**Contents**hide

#### Best Answer

If you use the `lsmeans`

function directly rather than via `glht`

, you might have better luck.

`library(lsmeans) ( mod.pairs = contrast(lsmeans(model_final, ~ cond|time), "trt.vs.ctrl1") ) `

At this point, what you have is pairwise comparisons at each `time`

. Is it the `cond:time`

interaction you want to test? If so, compute contrasts of the above differences (column labeled `contrast`

):

`inter.con = contrast(mod.pairs, "trt.vs.ctrl1", by = NULL) test(inter.con, joint = TRUE) `

I'm suggesting using `trt.vs.ctrl1`

contrasts because it makes the right number of contrasts to match the d.f. However if you use `pairwise`

instead, it will give the same results (it will just have to work harder).

PS this does require the latest version of **lsmeans** (2.12) because the `joint`

option was not avaialble before then.

### Similar Posts:

- Solved – How to analyze interdependent interaction terms of lmer model
- Solved – Analysis of interaction with multiple levels in each factor (emmeans in mixed model)
- Solved – Setting custom three-way interaction contrasts in R
- Solved – Setting custom three-way interaction contrasts in R
- Solved – Setting custom three-way interaction contrasts in R