Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2005
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2005

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

Search the Archive

Re: Area Under Curve (Min Length Interval)

  • To: mathgroup at smc.vnet.net
  • Subject: [mg53909] Re: [mg53889] Area Under Curve (Min Length Interval)
  • From: Bob Hanlon <hanlonr at cox.net>
  • Date: Fri, 4 Feb 2005 04:11:03 -0500 (EST)
  • Reply-to: hanlonr at cox.net
  • Sender: owner-wri-mathgroup at wolfram.com

The minimum interval requires PDF[dist, a] == PDF[dist, b]

Needs["Statistics`"];
Needs["Graphics`"];

minimumInterval[dist_, area_?NumericQ] :=
    Module[{a,b,mu=Mean[dist],ae,be},
      ae=Max[mu/4,Domain[dist][[1,1]]];
      be=Min[2*mu,Domain[dist][[1,2]]];
      {a,b} /. FindRoot[{
            PDF[dist,a]==PDF[dist,b],
            CDF[dist,b]-CDF[dist,a]==area},
          {a,ae},{b,be}]];

dist=ChiSquareDistribution[5];

{a,b}= minimumInterval[dist,0.93]

{0.37253,10.3441}

FilledPlot[
    {0,UnitStep[x-a]-UnitStep[x-b],1}*
      PDF[dist,x],{x,
      Max[a-3,Domain[dist][[1,1]]],
      Min[b+3,Domain[dist][[1,2]]]},
    PlotPoints->50];


Bob Hanlon

> 
> From: Bruce Colletti <vze269bv at verizon.net>
To: mathgroup at smc.vnet.net
> Date: 2005/02/02 Wed AM 06:25:53 EST
> Subject: [mg53909] [mg53889] Area Under Curve (Min Length Interval)
> 
> 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}]
> 
> 
> 


  • Prev by Date: Re: Algebra of Einstein velocity addition
  • Next by Date: Re: Problem with a sum
  • Previous by thread: Re: Area Under Curve (Min Length Interval)
  • Next by thread: Re: Area Under Curve (Min Length Interval)