avehtari / ROS-Examples

Regression and other stories R examples
https://avehtari.github.io/ROS-Examples/
325 stars 256 forks source link

Type M error p59 is off. #109

Closed hadjipantelis closed 2 years ago

hadjipantelis commented 2 years ago

Great book!

In Sect. 4.4, in the paragraph the "Type M (magnitude) and type s (sign) errors", when the text reads "... and the expected exaggeration factor is 9.7." it is misleading as it should read "... and the expected exaggeration factor is 9.5.".

The function retrodesign::type_m as well as a manual calculation suggest that the expected exaggeration factor is a bit smaller than the one stated.

# Using retrodesign directly
set.seed(1)
mean(replicate(10000, retrodesign::type_m(0.02, 0.081)$type_m)) # 9.536564

# Manual calculation
set.seed(2)
mu = 0.02
sd = 0.081
N = 10* 10^6
the_effects = rnorm(N, mean=mu, sd=sd)
mean(abs(the_effects)[abs(the_effects) > qnorm(0.975)*sd])/mu # 9.538244
andrewgelman commented 2 years ago

The exact value here depends on where the rounding is done, also on whether we use 1.96 or 2 as our statistical significance threshold. But it makes sense for the calculations to be internally consistent, so I'll change it to 9.5.

avehtari commented 2 years ago

Thanks for reporting. The fix will be in PDF soon

hadjipantelis commented 2 years ago

Cool, I am glad I could help!