## Overall mean & standard deviation of groups of observations

version 1.0.0.0 (1.55 KB) by
Calculate the overall mean and standard deviation of groups of observations

372 Downloads

Updated 12 Mar 2012

View License

[alln, allmean, allstd] = overallmeanstd(grpn, grpmean, grpstd)
calculates the overall number of observations (alln), the mean (allmean)
and standard deviation (allstd) of multiple groups with given number of
observations (grpn), mean values (grpmean) and standard deviations
(grpstd) for each group
this is usefull if you don't have your observations stored anymore or
you have a really high number of observations
solution comes from ...
http://www.burtonsys.com/climate/composite_standard_deviations.html

Example: copy this example (uncommented) to your command window and press enter
grp1 = [50,43,45,56]
grp2 = [65,67,50,81,83,90]
grp3 = [43,77,66,84,94,54,67]
grpn = [size(grp1,2);size(grp2,2);size(grp3,2)]
grpmean = [mean(grp1);mean(grp2);mean(grp3)]
grpstd = [std(grp1);std(grp2);std(grp3)]
grps = [grp1,grp2,grp3];
[alln, allmean, allstd] = overallmeanstd(grpn, grpmean, grpstd)
n_ = size(grps,2)
mean_ = mean(grps)
std_ = std(grps)

### Cite As

Sebastian W (2021). Overall mean & standard deviation of groups of observations (https://www.mathworks.com/matlabcentral/fileexchange/35605-overall-mean-standard-deviation-of-groups-of-observations), MATLAB Central File Exchange. Retrieved .

##### MATLAB Release Compatibility
Created with R2011b
Compatible with any release
##### Platform Compatibility
Windows macOS Linux

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!