I want to verify using a bootstrap approach the hypothesis about a lack of the intervention effect within a group of six patients: pre-(X) post(Y) intervention measurement. My data
ID X Y
1 9.856 8.992
2 19.512 4.573
3 1.936 1.572
4 14.575 1.529
5 8.476 12.000
6 1.862 1.417
Within R (2.15.1) Ive written the following code, using the t-test for paired data, which relies on resampled pairs:
boot.p.value <- function(data, S)
{
boot.t.stat <- as.numeric()
t.stat <- t.test(x=data[,1], y=data[,2], paired=TRUE)$statistic
for(s in 1:S)
{
boot.data <- data[sample(1:nrow(data), replace=TRUE),] ## resample pairs
boot.t.stat[s] <- t.test(x=boot.data[,1],y=boot.data[,2], paired=TRUE)$statistic
}
p.value <- sum(1*(boot.t.stat >= t.stat))/S
return(p.value)
}
Where:
boot.p.value(data, S=1000) [1] 0.518
When repeated the resulting p-values values stay between .4 and .6.
For the same data set the SPSS ver. 19 for the paired samples t-test provides bootstrap-based p = 0.182, for 1000 resamples. Why this difference?