Allstats

Many statistics of a vector or matrix
4K Downloads
Updated 21 Jul 2011

View License

Editor's Note: This file was selected as MATLAB Central Pick of the Week

R= ALLSTATS(A) returns a structure R with several statistics of vector A. A grouping factor can be given in an optional vector. In that case all the statistics will be calculated per group. The stats calculated (returned as fields of R) are:
R.min= minimum
R.max= maximum
R.mean= mean
R.std= standard deviation
R.mode= mode
R.q2p5= 2.5 percentile
R.q5= 5 percentile
R.q25= 25 percentile
R.q50= 50 percentile (median)
R.q75= 75 percentile
R.q95= 95 percentile
R.q97p5= 97.5 percentile
R.kurt= Kurtosis
R.skew= Skewness

% Example. No groups
x= rand(10,1);
R= allstats(x)

% Example. With 2 groups
g= [1;1;1;1;1;2;2;2;2;2];
R= allstats(x,g)

Cite As

Francisco de Castro (2024). Allstats (https://www.mathworks.com/matlabcentral/fileexchange/25572-allstats), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2009a
Compatible with any release
Platform Compatibility
Windows macOS Linux
Categories
Find more on Descriptive Statistics and Visualization in Help Center and MATLAB Answers

Community Treasure Hunt

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

Start Hunting!
Version Published Release Notes
1.6.0.0

Calculation of the mode is adapted to discrete variables

1.4.0.0

avoid output...

1.3.0.0

Take into account the shape of data and groups vectors

1.2.0.0

Clarified help (hopefully). Included some error checking.

1.1.0.0

Added kurtosis and skewness

1.0.0.0