# Means do not tally

9 messages
Open this post in threaded view
|

## Means do not tally

 Hi all, here is my situation In my experiment, I expose 10 subjects to 24 different conditions of stimuli. Each condition is exposed to the same subject 3x. This would make each subject have 24x3=72 data points. All the subjects combined would have 72x10=720 data points with each condition having 30 datapoints. To find the grand average of each condition, I find the average of all the datapoints for a given condition. To find the SD for each condition, if I use the raw dataset (720 datapoints) it would not reflect the SD across subjects. Therefore, I compute the average for each condition per subject .i.e. For subject 1, I would find the average of condition 1 (average across 3 trials). and so on. With the average of each condition per subject, I then compute the SD. Since I computed the average of each condition per subject, theoretically, if i average the average of each condition per subject across all subjects, the result would be the same as the grand average. However, this is not the case when I use R or Excel. regardless of functions used. Anyone have any thoughts? Regards, Ruijie (RJ) -------- He who has a why can endure any how. ~ Friedrich Nietzsche         [[alternative HTML version deleted]] ______________________________________________ [hidden email] mailing list https://stat.ethz.ch/mailman/listinfo/r-helpPLEASE do read the posting guide http://www.R-project.org/posting-guide.htmland provide commented, minimal, self-contained, reproducible code.
Open this post in threaded view
|

## Re: Means do not tally

 Ruijie gmail.com> writes: > In my experiment, I expose 10 subjects to 24 different conditions of > stimuli. Each condition is exposed to the same subject 3x. > This would make each subject have 24x3=72 data points. All the subjects > combined would have 72x10=720 data points with each condition having 30 > datapoints. > > To find the grand average of each condition, I find the average of all the > datapoints for a given condition.  [snip] > Since I computed the average of each condition per subject, theoretically, > if i average the average of each condition per subject across all subjects, > the result would be the same as the grand average. > > However, this is not the case when I use R or Excel. regardless of functions > used. Anyone have any thoughts?   Nothing obvious springs to mind. We need a reproducible example. How different are the means computed in different ways?  Is the difference attributable to round-off error? ______________________________________________ [hidden email] mailing list https://stat.ethz.ch/mailman/listinfo/r-helpPLEASE do read the posting guide http://www.R-project.org/posting-guide.htmland provide commented, minimal, self-contained, reproducible code.
Open this post in threaded view
|

## Re: Means do not tally

 In reply to this post by Ruijie Noted. I have attached a list of some data in csv format. The first column is the SubID and the rest of the column are the mean of each condition for the particular subject. Average 1 is the average computed from each column in the list. Average 2 is computed from the raw data of all the data points of a condition. The difference is typically at the 3rd decimal place. If anyone needs the raw data, I could supply it after some clean up. I suspected round of errors but in all procedures in R, I retained 14 significant figures. How would the round off error affect the 3rd decimal place? Any ideas anyone? Regards, Ruijie (RJ) -------- He who has a why can endure any how. ~ Friedrich Nietzsche On 24 May 2010 22:47, jim holtman <[hidden email]> wrote: > It is hard to tell what you are doing without data and the results you > have gotten so far: > > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html> and provide commented, minimal, self-contained, reproducible code. > > > On Mon, May 24, 2010 at 10:35 AM, Ruijie <[hidden email]> wrote: > > Hi all, > > > > here is my situation > > > > In my experiment, I expose 10 subjects to 24 different conditions of > > stimuli. Each condition is exposed to the same subject 3x. > > This would make each subject have 24x3=72 data points. All the subjects > > combined would have 72x10=720 data points with each condition having 30 > > datapoints. > > > > To find the grand average of each condition, I find the average of all > the > > datapoints for a given condition. > > > > To find the SD for each condition, if I use the raw dataset (720 > datapoints) > > it would not reflect the SD across subjects. Therefore, I compute the > > average for each condition per subject .i.e. For subject 1, I would find > the > > average of condition 1 (average across 3 trials). and so on. > > With the average of each condition per subject, I then compute the SD. > > > > Since I computed the average of each condition per subject, > theoretically, > > if i average the average of each condition per subject across all > subjects, > > the result would be the same as the grand average. > > > > However, this is not the case when I use R or Excel. regardless of > functions > > used. Anyone have any thoughts? > > > > Regards, > > Ruijie (RJ) > > > > -------- > > He who has a why can endure any how. > > > > ~ Friedrich Nietzsche > > > >        [[alternative HTML version deleted]] > > > > ______________________________________________ > > [hidden email] 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. > > > > > > -- > Jim Holtman > Cincinnati, OH > +1 513 646 9390 > > What is the problem that you are trying to solve? > ______________________________________________ [hidden email] mailing list https://stat.ethz.ch/mailman/listinfo/r-helpPLEASE do read the posting guide http://www.R-project.org/posting-guide.htmland provide commented, minimal, self-contained, reproducible code.
Open this post in threaded view
|

## Re: Means do not tally

 Are you sure that you have the same number of data points in each of the summary cells that you show in your csv file that was sent?  You need to provide a reproducible example of all the data so we can see what you did.  The best information I can provide at this point is that you have a "bug" in your calculations. On Mon, May 24, 2010 at 11:10 AM, Ruijie <[hidden email]> wrote: > Noted. > > I have attached a list of some data in csv format. > > The first column is the SubID and the rest of the column are the mean of > each condition for the particular subject. > > Average 1 is the average computed from each column in the list. > Average 2 is computed from the raw data of all the data points of a > condition. > > The difference is typically at the 3rd decimal place. If anyone needs the > raw data, I could supply it after some clean up. > > I suspected round of errors but in all procedures in R, I retained 14 > significant figures. How would the round off error affect the 3rd decimal > place? > > Any ideas anyone? > > Regards, > Ruijie (RJ) > > -------- > He who has a why can endure any how. > > ~ Friedrich Nietzsche > > > On 24 May 2010 22:47, jim holtman <[hidden email]> wrote: >> >> It is hard to tell what you are doing without data and the results you >> have gotten so far: >> >> PLEASE do read the posting guide >> http://www.R-project.org/posting-guide.html>> and provide commented, minimal, self-contained, reproducible code. >> >> >> On Mon, May 24, 2010 at 10:35 AM, Ruijie <[hidden email]> wrote: >> > Hi all, >> > >> > here is my situation >> > >> > In my experiment, I expose 10 subjects to 24 different conditions of >> > stimuli. Each condition is exposed to the same subject 3x. >> > This would make each subject have 24x3=72 data points. All the subjects >> > combined would have 72x10=720 data points with each condition having 30 >> > datapoints. >> > >> > To find the grand average of each condition, I find the average of all >> > the >> > datapoints for a given condition. >> > >> > To find the SD for each condition, if I use the raw dataset (720 >> > datapoints) >> > it would not reflect the SD across subjects. Therefore, I compute the >> > average for each condition per subject .i.e. For subject 1, I would find >> > the >> > average of condition 1 (average across 3 trials). and so on. >> > With the average of each condition per subject, I then compute the SD. >> > >> > Since I computed the average of each condition per subject, >> > theoretically, >> > if i average the average of each condition per subject across all >> > subjects, >> > the result would be the same as the grand average. >> > >> > However, this is not the case when I use R or Excel. regardless of >> > functions >> > used. Anyone have any thoughts? >> > >> > Regards, >> > Ruijie (RJ) >> > >> > -------- >> > He who has a why can endure any how. >> > >> > ~ Friedrich Nietzsche >> > >> >        [[alternative HTML version deleted]] >> > >> > ______________________________________________ >> > [hidden email] 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. >> > >> >> >> >> -- >> Jim Holtman >> Cincinnati, OH >> +1 513 646 9390 >> >> What is the problem that you are trying to solve? > > -- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem that you are trying to solve? ______________________________________________ [hidden email] mailing list https://stat.ethz.ch/mailman/listinfo/r-helpPLEASE do read the posting guide http://www.R-project.org/posting-guide.htmland provide commented, minimal, self-contained, reproducible code.
Open this post in threaded view
|

## Re: Means do not tally

 Thanks for your help jim. I have attached the raw data to see if anyone else can replicate my problem. Regards, Ruijie (RJ) -------- He who has a why can endure any how. ~ Friedrich Nietzsche On 25 May 2010 00:17, jim holtman <[hidden email]> wrote: > Are you sure that you have the same number of data points in each of > the summary cells that you show in your csv file that was sent?  You > need to provide a reproducible example of all the data so we can see > what you did.  The best information I can provide at this point is > that you have a "bug" in your calculations. > > On Mon, May 24, 2010 at 11:10 AM, Ruijie <[hidden email]> wrote: > > Noted. > > > > I have attached a list of some data in csv format. > > > > The first column is the SubID and the rest of the column are the mean of > > each condition for the particular subject. > > > > Average 1 is the average computed from each column in the list. > > Average 2 is computed from the raw data of all the data points of a > > condition. > > > > The difference is typically at the 3rd decimal place. If anyone needs the > > raw data, I could supply it after some clean up. > > > > I suspected round of errors but in all procedures in R, I retained 14 > > significant figures. How would the round off error affect the 3rd decimal > > place? > > > > Any ideas anyone? > > > > Regards, > > Ruijie (RJ) > > > > -------- > > He who has a why can endure any how. > > > > ~ Friedrich Nietzsche > > > > > > On 24 May 2010 22:47, jim holtman <[hidden email]> wrote: > >> > >> It is hard to tell what you are doing without data and the results you > >> have gotten so far: > >> > >> PLEASE do read the posting guide > >> http://www.R-project.org/posting-guide.html> >> and provide commented, minimal, self-contained, reproducible code. > >> > >> > >> On Mon, May 24, 2010 at 10:35 AM, Ruijie <[hidden email]> wrote: > >> > Hi all, > >> > > >> > here is my situation > >> > > >> > In my experiment, I expose 10 subjects to 24 different conditions of > >> > stimuli. Each condition is exposed to the same subject 3x. > >> > This would make each subject have 24x3=72 data points. All the > subjects > >> > combined would have 72x10=720 data points with each condition having > 30 > >> > datapoints. > >> > > >> > To find the grand average of each condition, I find the average of all > >> > the > >> > datapoints for a given condition. > >> > > >> > To find the SD for each condition, if I use the raw dataset (720 > >> > datapoints) > >> > it would not reflect the SD across subjects. Therefore, I compute the > >> > average for each condition per subject .i.e. For subject 1, I would > find > >> > the > >> > average of condition 1 (average across 3 trials). and so on. > >> > With the average of each condition per subject, I then compute the SD. > >> > > >> > Since I computed the average of each condition per subject, > >> > theoretically, > >> > if i average the average of each condition per subject across all > >> > subjects, > >> > the result would be the same as the grand average. > >> > > >> > However, this is not the case when I use R or Excel. regardless of > >> > functions > >> > used. Anyone have any thoughts? > >> > > >> > Regards, > >> > Ruijie (RJ) > >> > > >> > -------- > >> > He who has a why can endure any how. > >> > > >> > ~ Friedrich Nietzsche > >> > > >> >        [[alternative HTML version deleted]] > >> > > >> > ______________________________________________ > >> > [hidden email] 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. > >> > > >> > >> > >> > >> -- > >> Jim Holtman > >> Cincinnati, OH > >> +1 513 646 9390 > >> > >> What is the problem that you are trying to solve? > > > > > > > > -- > Jim Holtman > Cincinnati, OH > +1 513 646 9390 > > What is the problem that you are trying to solve? > ______________________________________________ [hidden email] mailing list https://stat.ethz.ch/mailman/listinfo/r-helpPLEASE do read the posting guide http://www.R-project.org/posting-guide.htmland provide commented, minimal, self-contained, reproducible code.
Open this post in threaded view
|

## Re: Means do not tally

Open this post in threaded view
|