[Thread Prev][Thread Next][Index]

Re: how do I make a frequency distribution plot?



Hi Erik,

Have a look at the functions SORTI and SAMPLEI to sort your values into
increasing order (see SHOW FUNCTIONS SORT*, for example).

If you then use
    DEFINE AXIS/X occurences = SAMPLEI(my_var, SORTI(my_var))
    LET pdf = I[gx=occurences]
then the variable "pdf" is an empirical probability density function for
my_var.  You'll need to normalize by dividing by the total number of
points.

You can define your "split your range of values" by defining a new axis
    DEFINE AXIS/X=`lo`:`hi`:`delta` my_intervals

and you should find that

    pfd[gx=my_intervals@sum]

has the relative frequency of occurrence of my_var within each interval.
Also

    let cdf = pfd[gx=@iin]

will be the empirical cumulative probability density function.

==> All of this has been type-as-I-go and not tested for syntax.  If you
spend time on this a more thorough summary to the users group would be a
nice contribution. (We'll make an FAQ from it.)

See also the old Ferret script frequency_histogram.jnl, which performed
the same analysis using Ferret capabilities of 1994.

    - steve

=============================

Erik Buitenhuis wrote:

> Hi all,
>
> From a 2D dataset, I would like to make a frequency distribution plot,
> that is, how do I split the range of values (in my case the values are
> between 0 and 1) into a number of intervals (say from 0 to 0.05, from
> 0.05 to 0.1, etc) and then count the number of values that lie within
> each interval?
>
> Thanks for your help,
> Erik Buitenhuis.
>
> ------------------------------------------------------
> Dr. ir. Erik T. Buitenhuis
> Max-Planck-Institut für Biogeochemie
> Street address:
> Carl-Zeiss-Promenade 10, 07745 Jena, Deutschland.
> Mailing address:
> Postfach 10 01 64 D-07701 Jena Germany
> Tel: +49 3641 686 735
> Fax: +49 3641 686 710
> http://www.bgc-jena.mpg.de/~erik.buitenhuis/

--

                |  NOAA/PMEL               |  ph. (206) 526-6080
Steve Hankin    |  7600 Sand Point Way NE  |  FAX (206) 526-6744
                |  Seattle, WA 98115-0070  |  hankin@pmel.noaa.gov




[Thread Prev][Thread Next][Index]

Dept of Commerce / NOAA / OAR / PMEL / TMAP

Contact Us | Privacy Policy | Disclaimer | Accessibility Statement