[R] t-test problem
jwiley.psych at gmail.com
Thu Jun 17 07:08:06 CEST 2010
Look what happens when you use lower.tail=FALSE (see ?pt ). If that
is not your problem, perhaps you can provide a short sample vector
that replicates your results?
On Wed, Jun 16, 2010 at 10:02 PM, Worik R <worikr at gmail.com> wrote:
> When the t-stat is > 0 should I use 'pt' differently?
> I have been checking my results and (except for the example I posted) all
> the inconsistencies occur when t>0
> On Thu, Jun 17, 2010 at 10:30 AM, Worik R <worikr at gmail.com> wrote:
>> I have two pairs of related vectors
>> 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))
>>  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$p.value
>>  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.2$p.value
>>  0.8679732
>> This is what I expect.
>> clearly I misunderstand some thing. What is it?
> [[alternative HTML version deleted]]
> R-help at r-project.org mailing list
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
University of California, Los Angeles
More information about the R-help