[R] [FORGED] Re: Issue with t.test

SMRUTI BULSARI b@mrut| @end|ng |rom hotm@||@com
Fri Mar 22 18:19:16 CET 2019


Thank you very much, Rolf Turner, Greg Snow, Martin Maechler and the entire team for the discussion and responses to my query. It has helped getting and enhancing my clarity on the issue.
Kindest regards,
Smruti

Get Outlook for Android<https://aka.ms/ghei36>



From: Martin Maechler
Sent: Thursday 21 March, 20:25
Subject: Re: [R] [FORGED] Re:  Issue with t.test
To: Rolf Turner
Cc: Greg Snow, r-help using R-project.org, SMRUTI BULSARI


>>>>> Rolf Turner >>>>> on Wed, 13 Mar 2019 09:38:24 +1300 writes: > On 13/03/19 9:06 AM, Greg Snow wrote: > >> The only time I have seen t.test give a p-value of 1 is when the >> data mean exactly equals the null hypothesis mean and the alternative >> is the default of two.sided. > > Doesn't have to be *exact* equality. Just close! > E.g.: > set.seed(42) > x mew mew==mean(x) # FALSE > t.test(x,mu=mew) Well, it *prints* as 1. But we've talked about *exact* above: > t.test(x,mu=mew)$p.value [1] 0.9999792 > getOption("digits") [1] 7 > mean(x) [1] 0.6362622 > print(mean(x), digits=14) [1] 0.63626220719889 > t.test(x,mu=0.6362622072)$p.value [1] 1 > 1 - t.test(x,mu=0.6362622072)$p.value [1] 1.049139e-11 > So even we get much closer to the mean, there's still a difference to one, even though even less visibly. And then if you go really really close to the mean, small accuracy loss in the pt() function will kick in, and you'll occasionally will be correct, Rolf ... but only if you move **much** much closer .... and in this case, it even seems not to happen at all: > mx mx - mx*(1 + 2^(-53+7e-15)) [1] -1.110223e-16 > 1 - t.test(x,mu=mx*(1 + 2^(-53+7e-15)))$p.value [1] 1.110223e-15 > Cheers, Martin > cheers, > Rolf > -- > Honorary Research Fellow > Department of Statistics > University of Auckland


	[[alternative HTML version deleted]]



More information about the R-help mailing list