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)