rvlenth / emmeans

Estimated marginal means
https://rvlenth.github.io/emmeans/
364 stars 32 forks source link

Support for more adjustment #203

Closed phliulei closed 4 years ago

phliulei commented 4 years ago

Thank you for your great package.

Some paper recommended Dunnett’s C, Dunnett’s T3, Games-Howell, and Tamhane’s T2 for post hoc adjustment. Because

When the assumptions of equal sample sizes and variances were violated, only four tests adequately maintained the Type I error rate: Dunnett’s C, Dunnett’s T3, Games-Howell, and Tamhane’s T2.

Can emmeans support for (one of) them?

rvlenth commented 4 years ago

emmeans already supports all of these, at least to a close approximation. However, you need to understand that emmeans does not choose what model to use, it only computes results based on a model that you fitted. So if you fit a model using lm() or aov or afex::aov_ez() or a number of others, the underlying assumptuion of all those models is that the error variance is homogeneous across treatments.

So, the first step in understanding this is to study and understand what is said in the FAQ vignette qabout Welch's tests -- see https://cran.r-project.org/web/packages/emmeans/vignettes/FAQs.html#nowelch -- which explains how to fit a model using nlme::gls() that accommodates unequal variances. The rest of what I have to say assumes you have done that. Under that condition, ...

phliulei commented 4 years ago

Thank you so much. But I'm still a little confused:

When the assumptions of equal sample sizes (not the variances) were violated, adjust = "tukey" can be used taking Games-Howell's place in emmeans? As the papers said, tukey is not fit for unbalanced design, so we use Games-Howell .

rvlenth commented 4 years ago

As I tried to explain earlier, it depends on the model that you are giving to emmeans()..

The above are two different models. That's why the second one is not the regular Tukey method.

phliulei commented 4 years ago

I got it! Thank you for you patience.