One can easily split continuous data into two equally sized groups using
  g = x > median(x);
this simple function generalises this idea to more than two roughly equal groups using quantiles/percentiles. It returns a group indicator vector of the same length as the input vector suitable for use with functions like boxplot.
Example:
Given n-by-2 matrix of data X, show distribution of second variable within first variable's quartiles
  g = group_equally(X(:, 1), 4);
  boxplot(X(:, 2), g)
The function is similar to the Stata command "xtile", though might differ due to different definitions of percentiles; this function uses the definition from the reference below.
Reference:
http://www.bmj.com/content/309/6960/996.full
Cita come
Ged Ridgway (2025). Group Equally (https://it.mathworks.com/matlabcentral/fileexchange/28937-group-equally), MATLAB Central File Exchange. Recuperato .
Compatibilità della release di MATLAB
Compatibilità della piattaforma
Windows macOS LinuxCategorie
- Mathematics and Optimization > Optimization Toolbox > Optimization Results > Solver Outputs and Iterative Display >
 
Tag
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Scopri Live Editor
Crea script con codice, output e testo formattato in un unico documento eseguibile.
| Versione | Pubblicato | Note della release | |
|---|---|---|---|
| 1.0.0.0 | 
