想想买数百个公平的骰子。但是,您不知道它们是,因此通过多次投掷(1000+)来测试每个的期望值是否为 3.5 点。其中之一必须是“最好的”,如果你不考虑多次测试,几乎可以肯定在统计上是显着的。
回想一下,拒绝真空值的概率(实际上,由于渐近近似和有限样本大小失真等原因,这可能不完全正确)不取决于样本大小!
然后,您可能会错误地得出结论(或至少不正确,因为它并不比其他游戏更好,但也不比其他游戏差),这是您应该带入下一个棋盘游戏的游戏。
至于实际意义,这确实提供了一个线索,因为当你经常抛掷时,“获胜”的人很可能以平均得分略高于 3.5 的情况下获胜。
这是一个插图:
set.seed(1)
dice <- 100
throws <- 1000
tests <- apply(replicate(dice, sample(1:6, throws,
replace=T)), 2,
function(x) t.test(x, alternative="greater",
mu=3.5))
# right-tailed test, to look for "better" dice (assuming a
# game where many points are good, nothing hinges on this)
plot(1:dice, sort(unlist(lapply(1:dice, function(i)
tests[[i]]$p.value))))
abline(h=0.05, col="blue") # significance threshold not
# accounting for multiple testing
abline(h=0.05/dice, col="red") # Bonferroni threshold
max(unlist(lapply(1:dice, function(i) tests[[i]]$estimate)))
# the sample average of the "winner"

因此,在 Bonferroni 校正后,我们在此模拟运行中看到一些“显着”优于 0.05 水平的骰子,但没有一个骰子。然而,“获胜”的人(代码的最后一行)的平均值为 3.63,实际上,这与真正的期望值 3.5 相差不远。
我们还可以运行一个小蒙特卡洛练习——即多次上述练习,以平均可能来自 的任何“不常见”样本set.seed(1)。然后,我们还可以说明改变投掷次数的效果。
# Monte Carlo, with several runs of the experiment:
reps <- 500
mc.func.throws <- function(throws){
tests <- apply(replicate(dice, sample(1:6, throws,
replace=T)), 2,
function(x) t.test(x, alternative="greater",
mu=3.5))
winning.average <- max(unlist(lapply(1:dice, function(i)
tests[[i]]$estimate))) # the sample average of the "winner"
significant.pvalues <- mean(unlist(lapply(1:dice,
function(i) tests[[i]]$p.value)) < 0.05)
return(list(winning.average, significant.pvalues))
}
diff.throws <- function(throws){
mc.study <- replicate(reps, mc.func.throws(throws))
average.winning.average <- mean(unlist(mc.study[1,]))
mean.significant.results <- mean(unlist(mc.study[2,]))
return(list(average.winning.average,
mean.significant.results))
}
throws <- c(10, 50, 100, 500, 1000, 10000)
lapply(throws, diff.throws)
结果:
> unlist(lapply(mc.throws, `[[`, 1))
[1] 4.809200 4.108400 3.927120 3.692292 3.635224 3.542961
> unlist(lapply(mc.throws, `[[`, 2))
[1] 0.04992 0.05134 0.05012 0.04964 0.05006 0.05040
因此,正如预测的那样,统计显着结果的比例与投掷次数无关(所有小于 0.05值比例都接近 0.05),而实际意义——即平均点数的距离“最好的”一到 3.5 - 投掷次数减少。p