如果陷阱都被认为是独立的,那么这不是 测试的变体,它只是一个变体。但是因为它们是成对使用的,因此不是独立的,所以您要寻找的是 McNemar 测试的变体。不幸的是,对超过 2x2 矩阵的测试的任何修改仍然会受到影响,因为在 Less 列中的项目数量如此之少。χ2
你的影响是如此强大,我很想只报告数据。那有什么问题?当数据非常强大并且效果中几乎没有噪音时,很难理解为什么您不只报告您发现的内容并将其陈述为事实。统计数据并没有你想象的那么强大,也没有真正让这个引人入胜的数据故事变得更好。我担心它们只会被用来隐藏小样本问题。
如果您真的非常想要概率,那么重采样可能是您最好的选择。您可以执行排列或随机化测试。计算更多和更少条件之间的平均差异。然后随机打乱样本,保持配对,并计算新的平均差。在计算机上这样做数千次,然后找出您发现的差异在您采样的差异分布中的位置。较大或更大的影响的概率将是您要报告的p值。
这是一些可以做到的基本R。
dat <- matrix(c(6, 1, 3, 1, 15, 0, 0, 1, 0, 3), ncol = 2)
n <- nrow(dat)
eff <- diff( colSums(dat) )
samps <- rowSums(dat)
nsamp <- 5000
# bootstrap nsamp replications of your experiment
y <- replicate(nsamp, {
# get a random amount for each location and put it in the more trap
more <- sapply(1:n, function(i) {sample(samps[i]+1, 1) - 1})
# of course, the rest is in the less trap
less <- samps - more
# calculate effect (less - more might be backwards of what you want
# but it's what the diff command did above for the original effect so
#we keep calculating in the same direction
sum(less) - sum(more)
})
# two sided p-value
sum(y < eff | y > -eff) / nsamp
该 p 值是数据产生的影响与给出零假设的影响一样大或更大的概率,以及对代表性样本的假设(总是隐含的)。将其视为考虑如果 null 为真会发生什么。陷阱只会随机捕捉昆虫。想象一下,你在尽可能多的地方抓到了和你一样多的昆虫,然后看看这种分布是如何在陷阱中随机出现的。如果当 null 为真时您的效果不太可能发生,那么我们得出结论 null 不是。
或者,可以通过替换对效应分布进行抽样。通过这样做,可以引导效果的置信区间。
# get each separate effect
effs <- dat[,2] - dat[,1]
nsamp <- 1000
# bootstrap nsamp replications of your experiment
y <- replicate(nsamp, {
# randomly sample from the distribution of effects
effSamp <- sample(effs, replace = TRUE)
# get total sample effect
sum(effSamp)
})
# get y into order so we can get the distribution cutoffs
y <- sort(y)
# 95% CI
y[0.025 * nsamp]; y[0.975 * nsamp]