rvlenth / emmeans

Estimated marginal means
https://rvlenth.github.io/emmeans/
340 stars 30 forks source link

Adjusting p value across models #466

Closed gevro closed 4 months ago

gevro commented 4 months ago

Hi, I have multiple different models in my overall projects. These have to stay distinct, rather than combining them into a larger multivariate model. I'd like to post-hoc adjust the p-values produced by each model for the multiplicity of models in the project. The base p.adjust function could do this, but emmeans sometimes outputs pvalues of '< 0.0001', which preclude doing this accurately.

Is there a way to output more significant digits for these pvalues?

The emmeans digits options don't seem to affect this.

Thanks

rvlenth commented 4 months ago

The "<0.0001" is generated by the print method for the emmGrid object. If you do

smry <- summary(contrast(...))
smry$p.value

You will get the actual P values. This works because summary() results in an extension of data.frame

gevro commented 4 months ago

Thanks. I also figured out an alternative approach: I run a multivariate model, but then in the contrast function I use simple=list(grouping variable) and combine=TRUE. That seems to give the same result as running separate models for each of the grouping variable levels, and then adjusting p values across all the models.