Pregunta

Using Apache Commons Math, how do I get the median from a series of numbers?

The Commons Math User Guide says DescriptiveStatistics supports median, yet the JavaDocs for DescriptiveStatistics makes no mention of it. It does mention geometric mean, is this the same thing as median?

I do see getPercentile(double). Is getPercentile(50) the same as median?

¿Fue útil?

Solución

DescriptiveStatistics.getPercentile

The 50th percentile is, by definition, the median.

Otros consejos

Apache Commons Math is like a hurricane, so one has to check for the version he is going to mention. I am using the v3.6.1 now, and it includes Median (a Percentile override with fixed quantile = 50) and Percentile classes.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top