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

MathGroup Archive 2007

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

Search the Archive

Re: Probability Density Function

  • To: mathgroup at smc.vnet.net
  • Subject: [mg74807] Re: [mg74790] Probability Density Function
  • From: Darren Glosemeyer <darreng at wolfram.com>
  • Date: Fri, 6 Apr 2007 04:18:09 -0400 (EDT)
  • References: <200704050812.EAA20924@smc.vnet.net>

Tony Harris wrote:
> Hello,
>
> I have graphed a normal probability density function with a mean of 10 and a 
> standard deviation of 2.5.  I named this function f[x]
>
> I wanted to know how to use the "FilledPlot" to show the area under the 
> curve for (x<8) and (7.5<x<11).
>
> I have the probability for x<8 to be .212 and for 7.5<x<11 to be .497 by 
> calculating the definite integral of the function f[x] for these two 
> probabilities.
>
> I have the cacluation of the probabilities included but no idea on how to 
> continue and display each of these in a graph.
>
> Thanks,
>
> T Harris
>
>   

This can be accomplished by plotting the pdf and the pdf multiplied by a 
Piecewise function which is 1 for the desired region and 0 otherwise and 
filling from the Piecewise function to the axis.

This will illustrate the probability that x<8.

FilledPlot[PDF[NormalDistribution[10, 2.5], x]*{1, Piecewise[{{1, x < 
8}}]}, {x, 0, 20}, Fills -> {{{2, Axis}, Red}}]


Likewise, this will show the probability for 7.5<x<11.

FilledPlot[PDF[NormalDistribution[10, 2.5], x]*{1, Piecewise[{{1, 7.5 < 
x < 11}}]}, {x, 0, 20}, Fills -> {{{2, Axis}, Red}}, PlotPoints -> 20]


The two regions can be shown in the same plot if desired.

FilledPlot[PDF[NormalDistribution[10, 2.5], x]*{1, Piecewise[{{1, x < 
8}}], Piecewise[{{1, 7.5 < x < 11}}]}, {x, 0, 20}, Fills -> {{{2, Axis}, 
Red}, {{3, Axis}, Blue}}, PlotPoints -> 20]


However, there is some overlap in these two regions. A fourth function 
for the overlap region, as in the following, could be used to show this.

FilledPlot[PDF[NormalDistribution[10, 2.5], x]*{1, Piecewise[{{1, x < 8}}],
        Piecewise[{{1, 7.5 < x < 11}}], Piecewise[{{1, 7.5 < x < 8}}]}, 
{x, 0, 20},
      Fills -> {{{2, Axis}, Red}, {{3, Axis}, Blue}, {{4, Axis}, 
Purple}}, PlotPoints -> 50]


Darren Glosemeyer
Wolfram Research


  • Prev by Date: Re: bug in Integrate
  • Next by Date: Re: ftp from mathematica code
  • Previous by thread: Probability Density Function
  • Next by thread: Re: Probability Density Function