help-gsl
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-gsl] retrieving the (cumulative) probability at a specific coo


From: Andrew W. Steiner
Subject: Re: [Help-gsl] retrieving the (cumulative) probability at a specific coordinate from the gsl_histogram_pdf struct
Date: Wed, 29 Aug 2012 08:54:51 -0700

Hello Bas and all,

     Effectively, it seems that what you need is the CDF corresponding to a
gsl_histogram_pdf struct. Can you use the GSL interpolation routines directly
on the double *range, and double *sum pointers in the gsl_histogram_pdf struct?
In more detail: (i) take the two histograms, (ii) convert both to a pdf using
gsl_histogram_pdf_init(), (iii) create two gsl_interp objects using
gsl_histogram_pdf->range and gsl_histogram_pdf->sum, and then (iv) loop
over the domain, obtaining the CDF for each histogram from the gsl_interp
objects.

    This is what I was planning on doing for the cdf() function of
http://o2scl.sourceforge.net/o2scl/html/classprob__dens__hist.html
but haven't finished that yet.

Take care,
Andrew

On Wed, Aug 29, 2012 at 5:49 AM, Rhys Ulerich <address@hidden> wrote:
>> I have two PDF's with different amount of bins and for the KS test I need to
>> get the distance between both PDF's at specific coordinates (let's say that
>> the bins contain a variable of type float). I was hoping to be able to for
>> instance loop over all the bins, retrieve the lowest float value in any bin
>> and somehow calculate the probability at that float value from the other
>> PDF.
>>
>> Does anyone know if this is possible with the pdf struct in the GSL?
>
> A quick look at
> http://www.gnu.org/software/gsl/manual/html_node/The-histogram-struct.html
> suggests no.  The values in any given bin do not seem to be stored.
> You could, however, sort the original data and use a binary search to
> find the minimum and maximum value in any given bin using the bin
> boundaries from gsl_histogram's range member.
>
> Best of luck,
> Rhys
>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]