Re: Area Under Curve (Min Length Interval)
- To: mathgroup at smc.vnet.net
- Subject: [mg53902] Re: Area Under Curve (Min Length Interval)
- From: "Ray Koopman" <koopman at sfu.ca>
- Date: Wed, 2 Feb 2005 18:10:44 -0500 (EST)
- References: <ctqdm2$sd3$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
The minimum-length interval has equal densities at its endpoints. Needs["Statistics`"] F[x_] := CDF[ChiSquareDistribution[5],x] f[x_] := PDF[ChiSquareDistribution[5],x] FindRoot[{F[b]-F[a]==.93,f[b]==f[a]},{{a,1},{b,10}}] {F[b]-F[a],f[b]-f[a]}/.% {a->0.37253, b->10.3441} {0.93, 3.46945*^-18} Bruce Colletti wrote: > Re Mathematica 5.1. > > How would I compute the minimum length interval over which the area under f(x) is given? > > For instance, as shown below, f(x) is the PDF of a chi-square distributed random variable whose CDF is F[x]. Seeking the minimum length 93%-interval [a,b], the code returns "Obtained solution does not satisfy the following constraints within Tolerance -> 0.001..." Fiddling with options has been futile. > > Any ideas? Thankx. > > Bruce > > F[x_] := CDF[ChiSquareDistribution[5], x] > > Minimize[{b - a, F[b] - F[a] == 0.93, b > a > 0}, {a, b}] > > NMinimize[{b - a, F[b] - F[a] == 0.93, b > a > 0}, {a, b}]