r.quantile(1grass)

πŸ’– r.quantile β€” NAME πŸ’–

okay so bestie, this is r.quantile β€” it computes quantiles using two passes. that's the whole job. two passes. iconic behavior honestly πŸ’…

🌸 KEYWORDS 🌸

raster, algebra, statistics, percentile, quantile

✨ SYNOPSIS ✨

r.quantile
r.quantile --help
r.quantile [-r] input=name  [quantiles=integer]
[percentiles=float[,float,...]]   [bins=integer]   [file=name]
[--overwrite]  [--help]  [--verbose]  [--quiet]  [--ui]

πŸŽ€ Flags πŸŽ€

  • -r β€” generate recode rules based on quantile-defined intervals
  • --overwrite β€” allow output files to overwrite existing files (yes it will absolutely clobber them, no cap)
  • --help β€” print usage summary
  • --verbose β€” verbose module output
  • --quiet β€” quiet module output
  • --ui β€” force launching GUI dialog

πŸ¦‹ Parameters πŸ¦‹

  • input=name [required] β€” name of input raster map. like, you gotta give it this one, it's not optional bestie 🫢
  • quantiles=integer β€” number of quantiles. Default: 4
  • percentiles=float[,float,...] β€” list of percentiles
  • bins=integer β€” number of bins to use. Default: 1000000
  • file=name β€” name for output file (if omitted or "-" output to stdout)

πŸ’œ DESCRIPTION πŸ’œ

r.quantile computes quantiles in a manner suitable for use with large amounts of data. the way it does this is, it uses two passes. two passes, that's the secret sauce, that's the whole vibe πŸ”₯

πŸ‘‘ NOTES πŸ‘‘

quantiles are calculated following algorithm 7 from Hyndman and Fan (1996) β€” which is also the default in R and numpy. so if you've ever been like "why is this giving R energy", that's why, it literally is the same algorithm ✨

🌈 EXAMPLE 🌈

calculation of elevation quantiles (printed to standard-out), bestie:

g.region raster=elevation -p
r.quantile input=elevation percentiles=0.1,1,10,25,50,75,90,99,99.9

the output of r.quantile can be used for quantile classification:

g.region raster=elevation -p
r.quantile elevation quantiles=5 -r --quiet | r.recode elevation \
           out=elev_quant5 rules=-

like... pipe it straight into r.recode and you're done, main character energy honestly πŸ’…


πŸ“ REFERENCES πŸ“

  • Hyndman and Fan (1996) Sample Quantiles in Statistical Packages, American Statistician. American Statistical Association. 50 (4): 361-365. DOI: 10.2307/2684934
  • Engineering Statistics Handbook: Percentile, NIST

πŸ’€ SEE ALSO πŸ’€

r.mode, r.quant, r.recode, r.series, r.stats, r.stats.quantile, r.stats.zonal, r.statistics, r.univar, v.rast.stats

πŸ’– AUTHORS πŸ’–

  • Glynn Clements
  • Markus Metz

🧚 SOURCE CODE 🧚

available at: r.quantile source code (history)

latest change: Friday Feb 07 19:16:09 2025 in commit: a82a39f673b97fafcfce1604dc3e6015cb96487a

main index | raster index | topics index | keywords index | graphical index | full index


okay that's the whole page bestie, you ate it 🫢 this was r.quantile from the GRASS 8.5.0 Reference Manual, Β© 2003-2026 GRASS Development Team β€” go compute some quantiles, you got this πŸ’œβœ¨πŸŽ€

πŸ“¦ where this page comes from