# Re: mode?

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Mon, 3 Apr 2006 12:03:03 -0600 (MDT)

>Is there an easy way to compute mode (statistic) in NCL?
>It would be nice if there was a dim_mode function.
>For example, if I have a variable var(lat,lon,time), how can
>I get the mode for each grid point (mode(lat,lon))?
>

Conceptually easy .... Not so, in practice,
See Numerical Recipies "Estimation of the Mode ..."

Are the data guaranteed to be unimodal?
What to do if you have bimodal data?

```---
http://mathworld.wolfram.com/StatisticalMedian.html
"An interesting empirical relationship between
the mean, median, and mode which appears to hold
for unimodal curves of moderate asymmetry is given by
mean-mode = [approx] 3(mean-median)"
Hence, mode = mean - 3(mean-median)
mean   = dim_avg_Wrap(..)
median = dim_median(..)

mode   = mean              ; transfer meta data
mode   = mean - 3*(mean-median)
mode_at_long_name = "mode [approximate]"
mode@info      = "http://mathworld.wolfram.com/StatisticalMedian.html"
mode_at_equation  = "mean - 3*(mean-median)"

printVarSummary(mode)
Good luck
D
_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
```
Received on Mon Apr 03 2006 - 12:03:03 MDT

This archive was generated by hypermail 2.2.0 : Tue Apr 04 2006 - 11:27:39 MDT