[R] t-test problem

David Winsemius dwinsemius at comcast.net
Thu Jun 17 14:08:37 CEST 2010


On Jun 17, 2010, at 12:51 AM, Worik R wrote:

> If it were not for the fact that I get inconsistent results I would  
> be sure
> that I need...

I have not yet seen a proper challenge to your original assumption  
that the t-statistic should be the same as the p-value. They go in  
_opposite_ directions, so the fact that in one comparison they happen  
to be equal is either an unlikely random occurrence (or perhaps the  
intended consequence of a devious statistics instructor testing your  
knowledge of the basics.) P-values are bounded on the interval [0-1]  
while t-statistics have possible range [-Inf,Inf]

>
> 2*pt(stat, df)
>
> Section 8.1 of R-intro.pdf is explicit.
>
> Problem is it gives inconsistent results

It? "Inconsistent"? The impersonal pronoun should be strongly  
disparaged in technical discourse in my opinion.

-- 
David.

>
> Worik
>
> On Thu, Jun 17, 2010 at 10:30 AM, Worik R <worikr at gmail.com> wrote:
>
>> I have two pairs of related vectors
>> x1,y1
>>
>> and
>>
>> x2,y2
>>
>> I wish to do a test for differences in means of x1 and y1, ditto x2  
>> and y2.
>>
>> I am getting odd results

>>  I am not sure I am using 'pt' properly...
>>
>> I have not included the raw vectors as they are long.  I am  
>> interested if I
>> am using R properly...
>>
>>> c(length(x1), length(y1), length(x2), length(y2))
>> [1] 3436 1619 2677 2378
>>
>>
>> First where the T-stat and the DF do not give the same result as  
>> 't.test'
>> when passed into 'pt'
>>
>>> t.1 <- t.test(x1, y1)
>>> 2 * pt(t.1$statistic, t.1$parameter)
>>       t
>> 1.353946
>>> t.1$p.value
>> [1] 0.646054
>>
>> I would have thought these would have been the same.  Like below....
>>
>>> t.2 <- t.test(x2, y2)
>>> 2 * pt(t.2$statistic, t.2$parameter)
>>        t
>> 0.8679732
>>> t.2$p.value
>> [1] 0.8679732
>>
>> This is what I expect.
>>
>> clearly I misunderstand some thing.  What is it?
>>
>> cheers
>> Worik
>>
>
> 	[[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.



More information about the R-help mailing list