Re: [Rd] numerical issue with t.test

2024-09-16 Thread Ben Bolker
To be more specific, this replicates the computations that t.test is doing (stripped of all the different cases that stats:::t.test.default handles) z <- err1-err2 se <- sqrt(var(z)/length(z)) mz <- mean(z) tstat <- mz/se 2*pt(tstat, df= length(z)-1, lower.tail = FALSE) On 2024-09-16 10:54 a

Re: [Rd] numerical issue with t.test

2024-09-16 Thread Michael Dewey
Dear Toby I see no problem there. If you compute the mean and variance of err1 - err2 which is what the paired test is working on then that might help to see what is going on. Michael On 16/09/2024 15:47, Toby Hocking wrote: Hi! I expected that t.test should report a very large p-value (clo

[Rd] numerical issue with t.test

2024-09-16 Thread Toby Hocking
Hi! I expected that t.test should report a very large p-value (close to 1), even when using paired=TRUE, for the data below (which are very similar). However, I observe p-value = 0.02503 which indicates a significant difference, even though there is none. Can this be fixed please? This is with R-4.