Re: [R] Looped t.test results according to a subset variable

2007-10-23 Thread Michael A. Miller
Does pairwise.t.test, with paste(group, quiz) as the factor, do what you are looking for? Regards, Mike -- Michael A. Miller [EMAIL PROTECTED] Imaging Sciences, Department of Radiology, IU School of Medicine __ R-help@r

Re: [R] Looped t.test results according to a subset variable

2007-10-22 Thread jim holtman
It represents the subset of the data frame partitioned by 'x$quiz'. On 10/22/07, Matthew Dubins <[EMAIL PROTECTED]> wrote: > Yes!! That did it! > > Does .sub represent the different levels of the x$quiz indice? > > > > jim holtman wrote: > Is this what you were expecting? > by(x, x$quiz, functi

Re: [R] Looped t.test results according to a subset variable

2007-10-22 Thread Matthew Dubins
Yes!! That did it! Does .sub represent the different levels of the x$quiz indice? jim holtman wrote: > Is this what you were expecting? > > >> by(x, x$quiz, function(.sub) t.test(percent ~ group, data=.sub)) >> > x$quiz: 1 > > Welch Two Sample t-test > > data: percent by group

Re: [R] Looped t.test results according to a subset variable

2007-10-22 Thread jim holtman
Is this what you were expecting? > by(x, x$quiz, function(.sub) t.test(percent ~ group, data=.sub)) x$quiz: 1 Welch Two Sample t-test data: percent by group t = 6.3228, df = 6.231, p-value = 0.0006306 alternative hypothesis: true difference in means is not equal to 0 95 percent confiden

Re: [R] Looped t.test results according to a subset variable

2007-10-22 Thread Matthew Dubins
Hi, Following please find *some* of my data. percent quizgroup 100 1 High 100 1 High 100 1 High 25 1 Low 50 1 Low 75 1 High 50 1 Low 75 1 High 100 1 High 100 1 High 50 1

Re: [R] Looped t.test results according to a subset variable

2007-10-22 Thread jim holtman
I think what you want to write is: by(your.df, quiz, function(.sub){ t.test(percent ~ group, data=.sub) } On 10/22/07, Matthew Dubins <[EMAIL PROTECTED]> wrote: > I've tried to use by(), but the closest i got to it doing what I wanted > was using the following: > > by(percent, quiz, functio

Re: [R] Looped t.test results according to a subset variable

2007-10-22 Thread Julian Burgos
Could you post some of your data and your initial test, and explain why it didn't worked? It is difficult to figure out what is the problem with your call to by(). Julian Matthew Dubins wrote: > I've tried to use by(), but the closest i got to it doing what I wanted > was using the following:

Re: [R] Looped t.test results according to a subset variable

2007-10-22 Thread Matthew Dubins
I've tried to use by(), but the closest i got to it doing what I wanted was using the following: by(percent, quiz, function(percent) {t.test(percent~group, data=marks.long)}) But the results it gave me weren't t.tests of percent by group according to quiz number. Julian Burgos wrote: > See

Re: [R] Looped t.test results according to a subset variable

2007-10-22 Thread Julian Burgos
See by() Matthew Dubins wrote: > Hi all, > > I wrote a simple function that gives me multiple t.test results > according to a subset variable and am wondering whether or not I > reinvented the wheel. Observe: > > t.test.sub <- function (formula, data, sub, ...) > { > for(i in 1:ma

[R] Looped t.test results according to a subset variable

2007-10-22 Thread Matthew Dubins
Hi all, I wrote a simple function that gives me multiple t.test results according to a subset variable and am wondering whether or not I reinvented the wheel. Observe: t.test.sub <- function (formula, data, sub, ...) { for(i in 1:max(sub)) { print(t.test