title: How to perform a bootstrapped paired t-test in R?
body: <p>I would like to perform a bootstrapped paired t-test in R. I have tried this for multiple datasets that returned p&lt;.05 when using a parametric paired t-test however when I run the bootstrap I get p-values between 0.4 and 0.5. Am I running this incorrectly?</p>
  
  <pre><code>   differences&lt;-groupA-groupB
     t.test(differences) #To get the t-statistic e.g. 1.96
  
     Repnumber &lt;- 10000                  
     tstat.values &lt;- 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&lt;=-1.96)/Repnumber
  </code></pre>
  
  <p>Thank you!</p>