From tdhock5 @end|ng |rom gm@||@com  Mon Sep 16 16:47:20 2024
From: tdhock5 @end|ng |rom gm@||@com (Toby Hocking)
Date: Mon, 16 Sep 2024 10:47:20 -0400
Subject: [Rd] numerical issue with t.test
Message-ID: <CALK03d1EgjSDw69yKHyqO2y=-7-NVW58LikosoxrNqJhUmZ8OQ@mail.gmail.com>

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.4.1. For reference below I use paired=FALSE
with the same data, and I get p-value = 1 as expected.

> err1 = c(-1.6076199373862132, -1.658521185520103, -1.6549424312339873, -1.5887767975086149, -1.634129577540383, -1.7442711937982249)
> err2 = c(-1.6076199373862132, -1.6585211855201032, -1.6549424312339875, -1.5887767975086149, -1.6341295775403832, -1.7442711937982252)
> t.test(err1,err2,paired=TRUE)

    Paired t-test

data:  err1 and err2
t = 3.1623, df = 5, p-value = 0.02503
alternative hypothesis: true mean difference is not equal to 0
95 percent confidence interval:
 2.769794e-17 2.683615e-16
sample estimates:
mean difference
   1.480297e-16

> t.test(err1,err2,paired=FALSE)

    Welch Two Sample t-test

data:  err1 and err2
t = 0, df = 10, p-value = 1
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
 -0.06988771  0.06988771
sample estimates:
mean of x mean of y
-1.648044 -1.648044



[Rd] numerical issue with t.test
Toby Hocking