RE: eqiprobable intervals
- To: mathgroup at smc.vnet.net
- Subject: [mg41036] RE: [mg41020] eqiprobable intervals
- From: "Wolf, Hartmut" <Hartmut.Wolf at t-systems.com>
- Date: Wed, 30 Apr 2003 04:19:15 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
>-----Original Message----- >From: susanlcw at aol.com [mailto:susanlcw at aol.com] To: mathgroup at smc.vnet.net >Sent: Tuesday, April 29, 2003 11:24 AM >To: mathgroup at smc.vnet.net >Subject: [mg41036] [mg41020] eqiprobable intervals > > >Hi all, > >I am interested in finding a program that will divide the domain of >a probability density function >into n non-overlapping equiprobable intervals. Specifically, >I am working >with a normal distribution, where mean and standard deviation are known >(and I know how to define the pdf), so the area under the curve on each >interval would be 1/n. > >Any help would be greatly appreciated. >Thanks, >Susan > > Susan, your intervals quested are just the images of an equidistant partition of the unit interval [0, 1] by the inverse cumulated distribution function. In[1]:= << Statistics`ContinuousDistributions` In[2]:= cumulate = CDF[NormalDistribution[mu, sigma], x] Out[2]= (1/2)*(1 + Erf[(-mu + x)/(Sqrt[2]*sigma)]) Directly solving for the cumulate turns out not to be too helpful, as this is expressed by InverseFunction (at least with my veseion 4.1) In[3]:= sol[1/2] = Solve[cumulate[x] == 1/2, {x}] Out[3]= {{x -> InverseFunction[(1/2)* (1 + Erf[(-mu + x)/(Sqrt[2]*sigma)]), 1, 1][ 1/2]}} however Quantile does it: In[4]:= n = 5; (* for example *) In[5]:= Quantile[NormalDistribution[mu, sigma], #/n] & /@ Range[0, n] Out[5]= {mu + Sqrt[2]*sigma*InverseErf[0, -1], mu + Sqrt[2]*sigma*InverseErf[0, -(3/5)], mu + Sqrt[2]*sigma*InverseErf[0, -(1/5)], mu + Sqrt[2]*sigma*InverseErf[0, 1/5], mu + Sqrt[2]*sigma*InverseErf[0, 3/5], mu + Sqrt[2]*sigma*InverseErf[0, 1]} In[6]:= Partition[N[%], 2, 1] /. a_. DirectedInfinity[b_] + c_. :> DirectedInfinity[b] Out[6]= {{-\[Infinity], mu - 0.841621 sigma}, {mu - 0.841621 sigma, mu - 0.253347 sigma}, {mu - 0.253347 sigma, mu + 0.253347 sigma}, {mu + 0.253347 sigma, mu + 0.841621 sigma}, {mu + 0.841621 sigma, \[Infinity]}} your intervals. -- Hartmut Wolf