MathGroup Archive 2006

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: which polynomial interpolant is good for CDF representation

  • To: mathgroup at smc.vnet.net
  • Subject: [mg67926] Re: which polynomial interpolant is good for CDF representation
  • From: Paul Abbott <paul at physics.uwa.edu.au>
  • Date: Fri, 14 Jul 2006 02:11:31 -0400 (EDT)
  • Organization: The University of Western Australia
  • References: <e95ab6$f5i$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

In article <e95ab6$f5i$1 at smc.vnet.net>, glare22 at gmail.com wrote:

> I want to get the value of random variables corresponding to a set of
> CDF( cumulative density function) points( or collocation points). I
> have thought to use a set of uniform distributed variables to get the
> cdf and then use a polynomial interpolant to fit the cdf curve and use
> interplolant to get the random variables from a set of cdf points.
> e.g.
> y_i=cdf(x_i), (x_i, are selected from small value to a large value in
> uniform interval)
> xo_i=polyf(y_i,x_i,yo_i), (yo_i are the collocation points of cdf, xo_i
> are what I want from the corresponding collocation points. polyf()
> denotes the polynomial interpolant function)
> 
> But many problems happen, sometimes the results oscillate.Sometimes it
> cannot get any results, since some values of cdf are indistinctive,
> like upper to some level, all the cdf equal to 1.0. How can I  do? Does
> the problem exist in the method? Or a proper choice of polynomial
> interpolant will help this problem. Is there a good way to represent
> the cdf by choosing a set of proper ramdom variables to avoid the
> undistinct of the cdf value? Thanks a lot.

An example of this appeared in the The Mathematica Journal 6(3):66-67. 
See

  http://physics.uwa.edu.au/pub/Mathematica/MathGroup/InverseCDF.nb

The essential idea is to use Plot to sample the CDF non-uniformly and 
then use (Newton) Interpolation to obtain the inverse CDF.

For discrete distributions, prescribe the relative frequencies of a set 
of numbers by the cumulative frequencies

  cumfreq[x_List] := FoldList[Plus, 0, x]/Total[x]

and produce an inverse cumulative distribution interpolating function.

  icdf[x_List] := icdf[x] = Interpolation[Transpose[
    {cumfreq[x], Range[0, Length[x]]}], InterpolationOrder -> 0]

For example, here is the inverse CDF of a loaded die with 3 and 4 
favored:

  Plot[icdf[{1, 1, 3, 2, 1, 1}][x], {x, 0, 1}]

After loading the statistics stub

  << Statistics`

here are the sample frequencies

  Table[icdf[{1, 1, 3, 2, 1, 1}][Random[]], {1000}]; 
  
  Frequencies[%]
  
Cheers,
Paul


Cheers,
Paul

_______________________________________________________________________
Paul Abbott                                      Phone:  61 8 6488 2734
School of Physics, M013                            Fax: +61 8 6488 1014
The University of Western Australia         (CRICOS Provider No 00126G)    
AUSTRALIA                               http://physics.uwa.edu.au/~paul


  • Prev by Date: Re: principal value
  • Next by Date: Re: Hamiltonian circuits
  • Previous by thread: Re: p-th power of quartic polynom of the n variables
  • Next by thread: Network Protocol