Plots and Random #s EXCEL Functions
Obtaining a Density Function l Create a column with a range of values of x containing a large portion of the density l Create a column that evaluates f(x) at each value of x (Specific denities below) l Repeat previous step for multiple pdf’s l Highlight columns with x (left-hand column) and f(x) (right hand column(s)) l Chart Wizard XY (Scatter) Picture with Smooth curves/No points
Families of Densities Gamma( ): f(x)=GAMMADIST(x, ,FALSE) Exponential ( =1 ) special case of Gamma Chi-Square ( n/2, =2 ) special case of Gamma Normal( 2 ): f(x)=NORMDIST(x, FALSE) l Other densities obtained by directly typing in f(x)
Example: Gamma( ) Cell A1 =GAMMADIST(a1,2,2,False) Cell A1500 =GAMMADIST(a1500,2,2,False)
Example: Gamma( )
Cumulative Distribution Function l Create a column with a range of values of x containing a large portion of the density l Create a column that evaluates F(x) at each value of x (Specific denities below) l Repeat previous step for multiple pdf’s l Highlight columns with x (left-hand column) and F(x) (right hand column(s)) l Chart Wizard XY (Scatter) Picture with Smooth curves/No points
Families of CDF’s Gamma( ): F(x)=GAMMADIST(x, ,TRUE) Exponential ( =1 ) special case of Gamma Chi-Square ( n/2, =2 ) special case of Gamma Normal( 2 ): F(x)=NORMDIST(x, TRUE) Beta( ): F(x)=BETADIST(x, ) l Others obtained by directly entering cdf
Example - Gamma( ) Cell A1 Cell A1500 =Gammadist(a1,2,2,True) =Gammadist(a1500,2,2,True)
Example - Gamma( )
Selecting Pseudo-Random Variables l Select a sample size and density function In EXCEL, type: =RAND() Copy and Paste that cell to n-1 below it Highlight all n cells: COPY PASTE SPECIAL VALUES l This is a pseudo-random sample from a uniform(0,1) distribution l Obtain random sample from inverting cdf
Families of Distributions l Labelling your U(0,1) value as p Gamma( ) X=GAMMAINV(p, ) Normal( ) X=NORMINV(p, ) Beta( ) X=BETAINV(p, ) l Copy and Paste this function for all n p’s
Simulating Gamma(2,2) RVs In cell A1 type: =RAND() l Copy/Paste to cells A2:A10000 l Copy/Paste Special/Values cells A1:A10000 In cell B1 type: =GAMMAINV(A1,2,2) l Copy/Paste to cells B2:B10000 (May take a few seconds)
Example Gamma(2,2) 1st 10 p 1st 10 X Empirical Results Theoretical Values