MathGroup Archive 1999

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

Search the Archive

Re: Discrete probablitiy distributions

  • To: mathgroup at smc.vnet.net
  • Subject: [mg16374] Re: Discrete probablitiy distributions
  • From: "Stephen P Luttrell" <luttrell at signal.dra.hmg.gb>
  • Date: Thu, 11 Mar 1999 02:16:46 -0500
  • Organization: Defence Evaluation and Research Agency
  • References: <7bo143$dqc@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

>Given the probability function for a discrete random variable, e.g in
>the form of a list of probabilities
>
>1. Plot the probability function (I can do this with ListPlot or
>BarChart)
>
>2. Plot the cumulative probability function.


Here is a way of doing this (for a list of 10 probabilities):

In[1]:=Needs["Graphics`Graphics`"];
In[2]:=prob=(#/Apply[Plus,#])&[Table[Random[],{10}]];
In[3]:=probcum=Drop[FoldList[Plus,0,prob],1];
In[4]:=BarChart[prob,probcum,PlotRange->All];

The second line generates probabilities (using the pure function
(#/Apply[Plus,#])& to normalise the list).
The third line generates a list of cumulative probabilities.
The fourth line plots these two lists.

==========================================================

Stephen P Luttrell
Signal Processing and Imagery Department
DERA Malvern, St.Andrew's Road
Malvern, United Kingdom, WR14 3PS

+44 (0)1684 894046 (tel)
+44 (0)1684 894384 (fax)
luttrell at signal.dera.gov.uk (email)





  • Prev by Date: Re: Position of element in a list
  • Next by Date: Re: Problem with pasting Mathematica grafics to Word 97
  • Previous by thread: Re: Discrete probablitiy distributions
  • Next by thread: Multiplying a constant to a matrix column