mice icon indicating copy to clipboard operation
mice copied to clipboard

p-values imprecision for summary.mipo

Open AndrewLawrence opened this issue 2 years ago • 0 comments

Hi there, thanks for the excellent package!

I was pooling some data and noticed some (highly significant) p-values were coming out as 0 which then messes with multiple comparisons correction.

I dug in the code and spotted the following line in summary.mipo:

https://github.com/amices/mice/blob/1c1ac6fd542ae11b1ab0225699a7b1e1ea09989f/R/mipo.R#L71

I think that the 1 - pt(...) introduces numerical problems and it's more precise to use pt(..., lower.tail = FALSE) to get the complement.

For example:

2 * (1 - pt(abs(-11.5), df = 104))
# [1] 0 

2 * (pt(abs(-11.5), df = 104, lower.tail = FALSE))
# [1] 3.059153e-20 

Looks like a simple fix, I will knock up a quick PR with the code and link this issue.

AndrewLawrence avatar May 11 '22 10:05 AndrewLawrence