[R] t-test

arun smartpink111 at yahoo.com
Thu Oct 4 14:59:13 CEST 2012


Hi John,
You are right.  With more than two groups, the type 1 error rate should be a problem.
A.K.



----- Original Message -----
From: John Kane <jrkrideau at inbox.com>
To: arun <smartpink111 at yahoo.com>
Cc: 
Sent: Thursday, October 4, 2012 8:40 AM
Subject: Re: [R] t-test

My stats are lousy but isnt Nico doing some multiple t-tests when an anova with some post hoc comparisons complete with a Tukey or Bonferroni correction looks more suitable?  

Of course I have no idea of the topic area and maybe he has already done thi.

John Kane
Kingston ON Canada


> -----Original Message-----
> From: smartpink111 at yahoo.com
> Sent: Thu, 4 Oct 2012 05:31:55 -0700 (PDT)
> To: nicomet80 at gmail.com
> Subject: Re: [R] t-test
> 
> HI,
> Try this:
> sapply(split(dat,dat$Name),function(x) t.test(x[,2],dat[,2])$p.value)
> #    CTK100     CTK103     CTK121
> #0.86330310 0.32706859 0.02023357
> A.K.
> 
> 
> 
> ----- Original Message -----
> From: Nico Met <nicomet80 at gmail.com>
> To: Rui Barradas <ruipbarradas at sapo.pt>
> Cc: r-help at r-project.org; r-help <r-help at stat.math.ethz.ch>
> Sent: Thursday, October 4, 2012 6:37 AM
> Subject: Re: [R] t-test
> 
> Dear Rui,
> 
> Many thanks for help.
> 
> "mean for CTK and all"  = comparison between mean of all groups ( which
> means second col) vs. each groups like CTK100, CTK121 etc.
> 
> Regards
> 
> Nico
> 
> On Thu, Oct 4, 2012 at 12:28 PM, Rui Barradas <ruipbarradas at sapo.pt>
> wrote:
> 
>> Hello,
>> 
>> I'm not quite sure I understand, but something like this?
>> 
>> tapply(dat$Score, dat$Name, FUN = mean)
>> sapply(unique(dat$Name), function(un){
> >     with(dat, t.test(Score[Name == un], Score[Name != un])$p.value)})
>> 
>> My doubt is in what you mean by "mean for CTK and all". The ?t.test
>> gives
>> a confidence interval for the difference in the means, so maybe you'll
>> have
>> to look there for what you want.
>> 
>> Hope this helps,
>> 
>> Rui Barradas
>> Em 04-10-2012 10:34, Nico Met escreveu:
>> 
>>> Dear Group,
>>> 
>>> I want to do a t-test calculation on a large data set.
>>> 
>>> I am pasting some part of it
>>> 
>>> structure(list(Name = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 3L,
>>> 3L, 3L, 3L, 3L, 3L, 3L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
>>> 2L), .Label = c("CTK100", "CTK103", "CTK121"), class = "factor"),
> >>      Score = c(236.9726, 207.0055, 237.3464, 224.4774, 236.5034,
> >>      206.7382, 233.94, 240.31, 240.9, 235.15, 223.36, 248.67,
> >>      249.25, 201.4051, 244.1689, 182.2756, 229.001, 241.3211,
> >>      196.0453, 232.6055, 225.0783, 196.0453, 232.6055, 225.0783
> >>      )), .Names = c("Name", "Score"), class = "data.frame", row.names
> =
>>> c(NA,
>>> 24L))
>>> 
>>> 
>>> I want to compare groups with CTK100 and with all the groups and want
>>> to
>>> save the p-values and mean for each of that particular group (for
>>> example:
>>> mean for CTK and all)
>>> Similarly, for other groups like that CTK121 etc...
>>> 
>>> Is there any way to automate this process?
>>> 
>>> Thanks for your advice !!!!!
>>> 
>>> Nico
>>> 
> >>         [[alternative HTML version deleted]]
>>> 
>>> ______________________________**________________
>>> R-help at r-project.org mailing list
>>> https://stat.ethz.ch/mailman/**listinfo/r-help<https://stat.ethz.ch/mailman/listinfo/r-help>
>>> PLEASE do read the posting guide http://www.R-project.org/**
>>> posting-guide.html <http://www.R-project.org/posting-guide.html>
>>> and provide commented, minimal, self-contained, reproducible code.
>>> 
>> 
>> 
> 
>     [[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.
> 
> 
> ______________________________________________
> 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.

____________________________________________________________
FREE 3D MARINE AQUARIUM SCREENSAVER - Watch dolphins, sharks & orcas on your desktop!
Check it out at http://www.inbox.com/marineaquarium




More information about the R-help mailing list