This website (http://atozmath.com/CONM/Ch2_CombinedSD.aspx) has a calculator that does exactly what I want, but it is limited to just 3 groups, while I have 13 groups to combine.
Hello Mohammed. This is a basic ANOVA problem. From the group data, you can compute SS_within and SS_between, and then sum them to get SS_total. Here is an example using Stata. If you don't use Stata, you should be able to translate the code to another package fairly easily.
* Try to duplicate results from calcualtor at
* http://atozmath.com/CONM/Ch2_CombinedSD.aspx
clear
input n m s
40 10 1
60 15 2
50 20 2
end
* n = sample size
* m = mean
* s = SD
egen N = total(n) // N = column total for n
egen SUM = total(n*m) // SUM = column total for n*m
generate MEAN = SUM/N
egen SSw = total((n-1)*s^2) // SS within rows
egen SSb = total(n*(m-MEAN)^2) // SS between rows
generate SStot = SSb+SSw // Total SS
generate SD = sqrt(SStot/(N-1))
list N MEAN SD
* Note: The website divides by N, not N-1
* when computing the grand SD.
Results:
N = 150
MEAN = 15.33333
SD = 4.260269
This approach can take as many rows of data as you like.
Hi Bruce, thanks a whole lot. Should I be worried that the website divides by N, not N-1? Cos I have ran a few numbers on it.
Plus I am not very good with syntax and command, however, I am downloading R now. I self-learned those a longtime ago, before I ditched them for a simpler SPSS.
It just occurred to me that any program that performs one-way ANOVA from summary data can be used to do this too, and more easily. E.g., in Stata, one can use the user-written program -aovsum-. E.g.,
* Type -findit aovsum- to find and install
* user-written program -aovsum-, which performs
* one-way ANOVA from summary data.
aovsum, n(40 60 50) m(10 15 20) sd(1 2 2)
Here is the first part of the output (copy and view in fixed font to make it clearer):
Groups | Summary of Response variable
(cells) | Mean Std. Dev. Obs.
------------+------------------------------------
1 | 10 1 40
2 | 15 2 60
3 | 20 2 50
------------+------------------------------------
Total | 15.333333 4.2602686 150
The Total row at the bottom shows the grand mean, grand SD and total N.
In SPSS, the ONEWAY command can be used to perform one-way ANOVA on summary data. See the example at the link given below. To get the table of descriptive stats showing the grand mean & SD, you'll need to add a STATISTICS sub-command that includes option DESCRIPTIVES. I don't have SPSS on this machine, so cannot test, but something like this should work:
Despite you have your problem solved by using the Bruce and Salvatore SPSS and R approaches you (or other users) may also find useful to use the attached Excel spreadsheet.
The pooled mean is straightforwardly obtained as MEAN = (N1* MEAN1+N2* MEAN2+...+N13*MEAN13)/(N1+N2+...+N13) and the pooled variance is obtained as SD2 = [(N1-1)*SD12+(N2-1)*SD22+...+(N13-1)*SD132]/(N1+N2+...+N13-13). Therefore the pooled standard deviation is SD=SQRT(SD2). In the above, MEANi, SDi and Ni are respectively the mean, standard deviation and the size of the ith group. You can use any software to calculate these.