[Date Index]
[Thread Index]
[Author Index]
RE: how to graphically fill the tails of a normal distribution
*To*: mathgroup at smc.vnet.net
*Subject*: [mg50022] RE: [mg50012] how to graphically fill the tails of a normal distribution
*From*: "David Park" <djmp at earthlink.net>
*Date*: Thu, 12 Aug 2004 05:43:28 -0400 (EDT)
*Sender*: owner-wri-mathgroup at wolfram.com
Todd,
Needs["Statistics`ContinuousDistributions`"]
Needs["Graphics`FilledPlot`"]
Needs["Graphics`Graphics`"]
Needs["Graphics`Colors`"]
npdf[x_] = PDF[NormalDistribution[0, 1], x];
DisplayTogether[
FilledPlot[{0, npdf[x]}, {x, -4, -2}, Fills -> Red],
FilledPlot[{0, npdf[x]}, {x, 2, 4}, Fills -> Red],
FilledPlot[npdf[x], {x, -2, 2}, Fills -> LightBlue],
Epilog -> {Line[{{-2, 0}, {-2, npdf[-2]}}],
Line[{{2, 0}, {2, npdf[2]}}]},
PlotRange -> All,
Frame -> True,
Axes -> None,
PlotLabel -> "Normal Distribution with Filled Tails",
Background -> Linen,
ImageSize -> 450];
David Park
djmp at earthlink.net
http://home.earthlink.net/~djmp/
From: Todd Allen [mailto:genesplicer28 at yahoo.com]
To: mathgroup at smc.vnet.net
Hello all,
Hope you don't mind a question from a biologist trying to learn
Mathematica. I have been teaching myself the syntax of Mathematica to
analyze microarray data (i.e, a technology to simultaneously monitor the
expression levels of thousands of genes). I am interested in producing a
plot for a presentation in which the tails of a normal distribution are
colored red to illustrate a concept. I can get the plot to work with a
single tail, but I can't get the syntax to work for both tails of the
disribution. Here is my code:
This works for a single tail, with the following code (necessary packages
already loaded):
ndist=NormalDistribution[0,1]
npdf=PDF[ndist,x]
FilledPlot[{npdf,If[x³2,0,npdf]},{x,-4,4},Fills®RGBColor[1,0,0]]
However when I try the following with the Or operator (at least I think Or
operator):
FilledPlot[{npdf,If[x³2.0þx£-2.0,0,npdf]},{x,-4,4},Fills®RGBColor[1,0,0]]
I get a series of error messages:
Plot:plnr:If[x³2.0þx£-2.0,0,npdf] is not a machine-size real number at x=-4
This error repeats itself with different x values and then a normal curve is
drawn with neither tail colored in.
What am I missing here?
Any insight is much appreciated, thanks!
Todd
Prev by Date:
**Re: x-ArcSin[Sin[x]]**
Next by Date:
**Re: message 50001?**
Previous by thread:
**Re: how to graphically fill the tails of a normal distribution**
Next by thread:
**raw image file**
| |