Re: [R] p-values always identical for t.test of certain group of samples, why ?

From: Eik Vettorazzi <E.Vettorazzi_at_uke.uni-hamburg.de>
Date: Tue, 15 Apr 2008 15:54:44 +0200

Why should it not be the same? Its the same dataset (up to scaling) you are testing on. Your effect (mean difference) will be different, but not your (standardized) t-statistic and df and therefore not your p-value. You will get the same result for the first if you simply test t.test(a,b)

hth.

Ng Stanley schrieb:
> Hi,
>
> Given the following,
>
> a <- rnorm(5)
> b <- rnorm(5)
> c <- rnorm(5)
> a.1g.scale <- scale(c(a,b,c))[1:5]
> b.1g.scale <- scale(c(a,b,c))[6:10]
> c.1g.scale <- scale(c(a,b,c))[11:15]
> a.2g.scale <- scale(c(a,b))[1:5]
> b.2g.scale <- scale(c(a,b))[6:10]
> c.2g.scale <- scale(c)
> a.3g.scale <- scale(a)
> b.3g.scale <- scale(b)
> c.3g.scale <- scale(c)
>
> I am puzzled why the p-values are identical for t.test(a.1g.scale,
> b.1g.scale), t.test(a.2g.scale, b.2g.scale), and t.test(a, b); similarly for
> t.test(a.3g.scale, b.3g.scale) and t.test(b.3g.scale, c.3g.scale); similarly
> for t.test(b.1g.scale, c.1g.scale) and t.test(b, c)
>
>
>> t.test(a.1g.scale, b.1g.scale)$p.value
>>
> [1] 0.7462252
>
>> t.test(a.2g.scale, b.2g.scale)$p.value
>>
> [1] 0.7462252
>
>> t.test(a.3g.scale, b.3g.scale)$p.value
>>
> [1] 1
>
>> t.test(b.1g.scale, c.1g.scale)$p.value
>>
> [1] 0.4995508
>
>> t.test(b.2g.scale, c.2g.scale)$p.value
>>
> [1] 0.885622
>
>> t.test(b.3g.scale, c.3g.scale)$p.value
>>
> [1] 1
>
>> t.test(a, b)$p.value
>>
> [1] 0.7462252
>
>> t.test(b, c)$p.value
>>
> [1] 0.4995508
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help_at_r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

-- 
Eik Vettorazzi
Institut für Medizinische Biometrie und Epidemiologie
Universitätsklinikum Hamburg-Eppendorf

Martinistr. 52
20246 Hamburg

T ++49/40/42803-8243
F ++49/40/42803-7790

______________________________________________
R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Received on Tue 15 Apr 2008 - 13:56:56 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 15 Apr 2008 - 15:00:28 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive