Re: [R] t-test problem

From: Oscar Rueda <Oscar.Rueda_at_cancer.org.uk>
Date: Thu, 17 Jun 2010 13:30:30 +0100


Hi Worik,

You can try
2*pt(abs(t1$statistic), t1$parameter, lower.tail=FALSE)

If the test is two sided.

Cheers,
Oscar

Oscar M. Rueda, PhD
Postdoc, Breast Cancer Functional Genomics Cancer Research UK Cambridge Research Institute Li Ka Shing Centre
Robinson Way
Cambridge CB2 0RE
England

On 16/6/10 23:30, "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.

This communication is from Cancer Research UK. Our website is at www.cancerresearchuk.org. We are a charity registered under number 1089464 and a company limited by guarantee registered in England & Wales under number 4325234. Our registered address is 61 Lincoln's Inn Fields, London WC2A 3PX. Our central telephone number is 020 7242 0200.  

This communication and any attachments contain information which is confidential and may also be privileged. It is for the exclusive use of the intended recipient(s). If you are not the intended recipient(s) please note that any form of disclosure, distribution, copying or use of this communication or the information in it or in any attachments is strictly prohibited and may be unlawful. If you have received this communication in error, please notify the sender and delete the email and destroy any copies of it.  

E-mail communications cannot be guaranteed to be secure or error free, as information could be intercepted, corrupted, amended, lost, destroyed, arrive late or incomplete, or contain viruses. We do not accept liability for any such matters or their consequences. Anyone who communicates with us by e-mail is taken to accept the risks in doing so.



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 Thu 17 Jun 2010 - 12:37:12 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 Thu 17 Jun 2010 - 12:50:31 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