IndrajeetPatil / groupedstats

Grouped statistical analysis in a tidy way 🔁💪♻
https://indrajeetpatil.github.io/groupedstats/
GNU General Public License v3.0
46 stars 11 forks source link

p value methods #20

Closed Benambridge closed 4 years ago

Benambridge commented 6 years ago

Thanks very much for this package! I'm sorry if this is covered somewhere in the documentation (I couldn't find it), but is there a way to control the method used to calculate the p values? I prefer to use the likelihood ratio test method outlined here [http://talklab.psy.gla.ac.uk/KeepItMaximalR2.pdf] but (a) I don't think there's a way to do this in lmerTest (as I understand it, it implements drop1 differently to lme4) and (b) if there is, I don't know how I would ensure that it's these p values that are passed to ggstatsplot? Thanks! Ben

IndrajeetPatil commented 6 years ago

@Benambridge You are right. Unfortunately, I haven't done a good job creating documentation for the ggcoefstats function. Will work on remedying this in future releases.

In their "Keep it maximal" paper (http://talklab.psy.gla.ac.uk/KeepItMaximalR2.pdf), Barr and colleagues tabulate different ways one can compute p-values for lmer models:

There are various ways to obtain p-values from LMEMs, and to our knowledge, there is little agreement on which method to use. Therefore, we considered three methods currently in practice: (1) treating the t-statistic as if it were a z statistic (i.e., using the standard normal distribution as a reference); (2) performing likelihood ratio tests, in which the deviance (−2LL) of a model containing the fixed effect is compared to another model without it but that is otherwise identical in random effects structure; and (3) by Markov Chain Monte Carlo (MCMC) sampling, using the mcmcsamp() function of lme4 with 10000 iterations.

Currently, ggcoefstats supports only the first method and adding support for the other two methods is not high priority right now. That said, this is something I will keep in mind in future.

IndrajeetPatil commented 4 years ago

The documentation now just points to parameters::p_value, which has more info: https://github.com/IndrajeetPatil/groupedstats/commit/a9b03a44af7123e4f38f69a6e869bd1e4e6b8143