Chapter 10 Excel Notes

advertisement

Bus 221 Excel Notes: Chapter 10

Probability Distributions and the Law of Large Numbers

Open up an Excel spreadsheet

Note: How To Select Cells o One cell: click on the cell o Multiple Cells (any rectangular shaped area of cells): click on the cell on upper far left of the group you want to select, hold the click, drag the cursor over to the cell on the lower far right of the group you want to select, and release the click. o A row of cells: click on the cell on the far left of the row, hold the click, drag the cursor over to the cell on the far right, and release the click. o A column of cells: click on the cell on the top of the column, hold the click, drag the cursor over to the cell on the bottom of the column, and release the click.

Create 3 different random samples of observations on a random variable, where the random variable has a uniform distribution over the interval [0, 1].

Create Sample 1 (small sample) with 15 observations: o Type the following formula into cell A1 and press return: =RAND() o This randomly generates an observation on a variable which has a uniform distribution over the interval [0, 1]. o Copy this formula into cells A2 – A15 by selecting cell A1 (just click on it), holding the cursor over the lower right corner of cell A1 until a “+” sign appears, then click, hold the click, and drag the cursor down to cell A15. You have now created a sample of 15 observations.

Create Sample 2 with 100 observations: o Type the following formula into cell B1 and press return: =RAND() o This randomly generates an observation on a variable which has a uniform distribution over the interval [0, 1]. o Copy this formula into cells B2 – B100 by holding the cursor over the lower right corner of cell B1 until a “+” sign appears, then click, hold the click, and drag the cursor down to cell B100. You have now created a sample of 100 observations.

Create Sample 3 with 1000 observations: o Type the following formula into cell C1 and press return: =RAND() o This randomly generates an observation on a variable which has a uniform distribution over the interval [0, 1]. o Copy this formula into cells C2 – C1000 by holding the cursor over the lower right corner of cell C1 until a “+” sign appears, then click, hold the click, and drag the cursor down to cell C1000. You have now created a sample of 1000 observations.

Now calculate the proportion of times that you had an observation with a value greater than

0.9 in each of your samples. Note that the probability of getting an observation with a value greater than 0.9 is 10% for the uniform distribution.

Sample 1: o Create a Label

In cell E1 type in: P(x>0.9)

In cell E2 type in: Small Sample

 Select the two above cells and then Bold them by clicking on the Bold “B” on the top left of the Excel spreadsheet (Make sure that the “Home” tab is selected on the top left of Excel. o Calculate the proportion of times that a number greater than 0.9 occurred in your sample.

Type the following into cell E3: =COUNTIF(A1:A5,">0.9")/COUNT(A1:A5)

Sample 2: o Create a Label

In cell F1 type in: P(x>0.9)

In cell F2 type in: Medium Sample

 Select the two above cells and then Bold them by clicking on the Bold “B” on the top left of the Excel spreadsheet (Make sure that the “Home” tab is selected on the top left of Excel. o Calculation the proportion of times that a number greater than 0.9 occurred in your sample.

Type the following into cell F3: =COUNTIF(B1:B100,">0.9")/COUNT(B1:B100)

Sample 3: o Create a Label

 In cell F1 type in: P(x>0.9)

In cell F2 type in: Large Sample

Select the two above cells and then Bold them by clicking on the Bold “B” on the top left of the Excel spreadsheet (Make sure that the “Home” tab is selected on the top left of Excel. o Calculation the proportion of times that a number greater than 0.9 occurred in your sample.

Type the following into cell G3: =COUNTIF(C1:C1000,">0.9")/COUNT(C1:C1000)

Create several multiple small, medium, and large samples o Reproduce the same three sets of labels in columns I, J, and K

To do this easily, do the following:

Select cells E1 – G2 by clicking on cell E1, holding the click, dragging the cursor over to cell G2, and releasing the click.

 Right click in the shaded area and select “copy.”

Right click on cell I1 and select the box on the far left under “past options.”

For clarity, change the word “sample” into the word “samples” by adding an “s” to the end of “sample” each of the three times that “sample” appears. o Now copy cells E3 – G3 by selecting the three cells, right clicking in the shaded area, and selecting “copy.” o Now paste into cell I3: right click on cell I3, select “past special”, click on the bubble next to “Values” and select “OK”. o Do this same procedure in cells I4 through I12.

Each time you paste you create a new set of 3 samples (the small sample, medium sample, and large sample).

When you are done, you will have the results for 10 different small samples, 10 different medium samples and 10 different large samples.

Analyze the results for the different sized samples:

o Now look at the 10 results you have for each of the small samples. That is, look at each row of column I. Here, each row of column I corresponds with each of the different small sized samples. o Do the same for the medium samples and the large samples. o Note how the larger sized samples tends to yield proportions which are more consistently close to 0.1, which is the true probability of getting a number greater than 0.9 in a uniform distribution over the interval [0, 1]. This is essentially what the Law of Large

Numbers says – that larger samples with yield proportions that are closer to the true probability. o Calculate the standard deviation for column I, J, and K. Are the differences in the standard deviation consistent with what you would expect, given the Law of Large

Numbers. (See a prior Excel handout for instructions on calculation the standard deviation.)

Print up your results in columns I – K, including the standard deviations for each of the three columns. Try to turn in a nice looking table if you can. (See a prior Excel handout for instructions on making and printing tables.)

Note that the standard deviation of a uniform distribution defined over the interval [a, b] is |a

– b| / (square root 12). You can use this to check the accuracy of the Central Limit Theorem which says that the standard deviation of a sampling distribution, σ xbar

= σ x

/ (square root of n). Here σ x

= 1 / (square root 12)

Download