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

Eik Vettorazzi E.Vettorazzi at uke.uni-hamburg.de
Tue Apr 15 15:54:44 CEST 2008


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



More information about the R-help mailing list