Presentation is loading. Please wait.

Presentation is loading. Please wait.

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.

Similar presentations


Presentation on theme: "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."— Presentation transcript:

1 Plots and Random #s EXCEL Functions

2 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

3 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)

4 Example: Gamma(  ) Cell A1 =GAMMADIST(a1,2,2,False) Cell A1500 =GAMMADIST(a1500,2,2,False)

5 Example: Gamma(  )

6 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

7 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

8 Example - Gamma(  ) Cell A1 Cell A1500 =Gammadist(a1,2,2,True) =Gammadist(a1500,2,2,True)

9 Example - Gamma(  )

10 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

11 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

12 Simulating 10000 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)

13 Example 10000 Gamma(2,2) 1st 10 p 1st 10 X Empirical Results Theoretical Values

14


Download ppt "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."

Similar presentations


Ads by Google