equiprobable intervals with triangular pdf
- To: mathgroup at smc.vnet.net
- Subject: [mg41443] equiprobable intervals with triangular pdf
- From: S White <susanlcw at aol.com>
- Date: Tue, 20 May 2003 03:23:25 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
Hello all,
I posted a couple of weeks ago about dividing a normal distribution
into n equiprobable intervals and received some great responses. I am
now working with a triangular pdf and need to do the same thing.
I am defining the triangular pdf on the interval [a,b] with mean at
(a+b)/2 as follows:
triPdf[x_,a_,b_]:=(2/(b-a))^2*(x-a)/;a<=x<(b+a)/2;
triPdf[x_,a_,b_]:=(2/(b-a))^2*(b-x)/;(b+a)/2<=x<=b;
triPdf[x_,a_,b_]:=0/;a>x||x>b;
triCdf[x_,a_,b_]:=N[Integrate[triPdf[y,a,b],{y,a,x}]]
When working with the normal command, the following function gave me
output in the form I need:
equiprob[dist_,n_]:=Partition[Table[Quantile[dist,k/n],{k,0,n}],2,1]
However, the Quantile function doesn't work on this triangular pdf.
I have worked on defining some function that would do the same thing
as the Quantile function does but I keep running into numerous error
messages and it only works for certain a and b.
Does anyone have a suggestion of a function that will give me
equiprobable intervals in the output form
{{a,x1},{x1,x2},...,{xn,b}},
where a,x1,...,xn,b are the endpoints of the equiprobable intervals?
I really appreciate any help...
Susan