An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20121004/f20d17c0/attachment.pl>
t-test
4 messages · Rui Barradas, Nico Met, arun
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 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20121004/682282f7/attachment.pl>
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.