[R] t-test

Jose Iparraguirre Jose.Iparraguirre at ageuk.org.uk
Thu Oct 4 16:56:45 CEST 2012


Hi,

You can also have a look at this paper (no subscription needed):

Herberich, E.; Sikorski, J.; and Hothorn, T. (2010). "A Robust Procedure for Comparing Multiple Means under Heteroscedasticity in Unbalanced Designs". PLoSONE, Vol. 5, Issue 3, e9788. doi:10.1371/journal.pone.0009788

In this paper, Herberich et al have included a piece of R code to run their procedure. Their procedure is a modification of Tukey, and as it says in the title of the paper, it can be used regardless of whether the samples had different sizes or distributions.

José


José Iparraguirre
Chief Economist
Age UK

T 020 303 31482
E Jose.Iparraguirre at ageuk.org.uk
Twitter @jose.iparraguirre at ageuk


Tavis House, 1- 6 Tavistock Square
London, WC1H 9NB
www.ageuk.org.uk | ageukblog.org.uk | @ageukcampaigns 


For a copy of our new Economic Monitor and the full Chief Economist's report, visit the Age UK Knowledge Hub http://www.ageuk.org.uk/professional-resources-home/knowledge-hub-evidence-statistics/


For evidence and statistics on the older population, visit the Age UK Knowledge Hub http://www.ageuk.org.uk/professional-resources-home/knowledge-hub-evidence-statistics/


-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf Of arun
Sent: 04 October 2012 13:59
To: John Kane
Cc: R help
Subject: Re: [R] t-test

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!


______________________________________________
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.

Age UK and YouthNet are official charities for the Virgin London Marathon 2013

We need you to Run for it. Join the team and help raise vital funds to bring generations together to combat loneliness and isolation.

Go to http://www.runforit.org.uk for more information or contact Helen Parson at helen.parsons at ageuk.org.uk or on 020 303 31369.

Age UK and YouthNet. A lifeline, online.

www.runforit.org.uk



Age UK Improving later life

www.ageuk.org.uk



-------------------------------
Age UK is a registered charity and company limited by guarantee, (registered charity number 1128267, registered company number 6825798). 
Registered office: Tavis House, 1-6 Tavistock Square, London WC1H 9NA.

For the purposes of promoting Age UK Insurance, Age UK is an Appointed Representative of Age UK Enterprises Limited, Age UK is an Introducer 
Appointed Representative of JLT Benefit Solutions Limited and Simplyhealth Access for the purposes of introducing potential annuity and health 
cash plans customers respectively.  Age UK Enterprises Limited, JLT Benefit Solutions Limited and Simplyhealth Access are all authorised and 
regulated by the Financial Services Authority. 
------------------------------

This email and any files transmitted with it are confide...{{dropped:28}}




More information about the R-help mailing list