MathGroup Archive 2004

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

Search the Archive

Re: how to graphically fill the tails of a normaldistribution

  • To: mathgroup at smc.vnet.net
  • Subject: [mg50040] Re: [mg50012] how to graphically fill the tails of a normaldistribution
  • From: Tomas Garza <tgarza01 at prodigy.net.mx>
  • Date: Thu, 12 Aug 2004 05:44:19 -0400 (EDT)
  • References: <200408110953.FAA04135@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

All I could find wrong were a couple of syntax errors. On copying your code
I found a) a strange sign where it should read Abs[x]>2, and b) The sign
after Fills should be -> and not @. Try this (I put a PlotRange option as
well):

In[26]:=
ndist = NormalDistribution[0, 1];
npdf = PDF[ndist, x];
FilledPlot[{npdf, If[Abs[x] > 2, 0, npdf]}, {x, -4, 4},
   Fills -> RGBColor[1, 0, 0], PlotRange -> {{-3, 3}, {0, 1}}];

Tomas Garza
Mexico City

----- Original Message ----- 
From: "Todd Allen" <genesplicer28 at yahoo.com>
To: mathgroup at smc.vnet.net
Subject: [mg50040] [mg50012] how to graphically fill the tails of a normal
distribution


>
> 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: how to graphically fill the tails of a normal distribution
  • Next by Date: Re: x-ArcSin[Sin[x]]
  • Previous by thread: Re: how to graphically fill the tails of a normal distribution
  • Next by thread: Re: how to graphically fill the tails of a normal distribution