R でブートストラップ ペア t 検定を実行したいと思います。パラメトリック ペア t 検定を使用すると p<.05 を返す複数のデータセットに対してこれを試しましたが、ブートストラップを実行すると 0.4 から 0.5 の間の p 値が得られます. これを間違って実行していますか?
differences<-groupA-groupB
t.test(differences) #To get the t-statistic e.g. 1.96
Repnumber <- 10000
tstat.values <- numeric(Repnumber)
for (i in 1:Repnumber) {
group1 = sample(differences, size=length(differences), replace=T)
tstat.values[i] = t.test(group1)$statistic
}
#### To get the bootstrap p-value compare the # of tstat.values
greater (or lesser) than or equal to the original t-statistic divided
by # of reps:
sum(tstat.values<=-1.96)/Repnumber
ありがとうございました!