You are on page 1of 7

Excel Exercise 2

1. Today will create random samples of data from different distributions and then examine them in
Excel. Open Excel and choose BLANK WORKBOOK. Left-click on the DATA tab in the upper part
of the screen.

2. Left-click on the DATA ANALYSIS button on the far right hand side of the screen.

If the data analysis button is not there, click on File and then
Options. In the box that pops up, Click Add-Ins and in
the Manage box, select Excel Add-ins. Hit the Go button. Click the
check box next to Analysis Tool Pack and then hit OK. Repeat step
2.

3. In the window that pops up, scroll down and select RANDOM NUMBER GENERATION. Hit OK.
You will draw one sample of size n=10 from a normally distributed population with mean μ=0
and standard deviation σ =1. The random seed of 1 ensures that we all obtain the same random
numbers. Click OK and the random numbers should appear in cells A1 through A10.
4. Calculate the sample mean ( x́ ¿ and sample standard deviation ( s), and put the results in cells B1
and B2. If you don’t remember how to do this, refer to last week’s tutorial. It is much easier to
use the =average() and =stdev.s() formulas rather than calculating them step-by-step.

5. Your estimates should be reasonably close to the population parameters. Next, draw a sample
of size n=100 from a population with mean = 50 and standard deviation = 10. Change the output
range to $D$1. Calculate the sample mean and sample standard deviation again and put the
answers in cells E1 and E2. With a larger sample size, the estimates should be closer to the
population parameters mu = 50 sigma = 10.

6. Look at the distribution of the data and see if it looks normally distributed by creating a
histogram of the data. The first step is to determine the size of the “bins”, which are the data
ranges for the histogram’s vertical bars. Sort the data in column D by selecting the cells D1
through D100. Now click on the SORT from smallest to largest button. If it asks you to expand
the current selection, select NO. Your data should now be sorted in ascending sequence.

7. Our data ranges from approximately 20 to 80. First create a histogram with just four bins. We
want one ranging from negative infinity to 0, one from 0 to 50, one from 50 to 100, and then
100 and above. Type “Bin range” in cell G1, in cell G2 type 0, in cell G3 type 50, and in cell G4
type 100. The numbers 0, 50 and 100 represent the upper limits of each bin.

8. Now click on the data analysis tool again (see step 2), but this time select HISTOGRAM. Input
the following values as shown below. The INPUT RANGE is the sample of data in column D and
the BIN RANGE points to the range for the bins. Be sure to check CHART OUTPUT and uncheck
LABELS.

9. The output should look like the following.

So there are 49 observations between 0 and 50, 51 observations between 50 and 100, and no
observations greater than 100 or less than 0. Because we only used four bins, the histogram isn’t
helpful. Now create a histogram with 7 bins. In cell G15, type “bin range” and then enter the
following values:

10. Create another histogram with the new bin ranges. Be sure to change the BIN RANGE and
OUTPUT RANGE in the histogram window.

Your output should now look more like a “bell curve”.


11. (OPTIONAL STEP) Make your histogram look nice. There are several things to change. First, right-
click on one of the blue bars and choose FORMAT DATA SERIES. Click on the icon with three
green bars and alter the gap width to 16%. Click the X to close the formatting sidebar.

Now right-click on the word “Frequency” on the left side of the chart and choose FORMAT
VERTICAL AXIS TITLE. Click on the size and properties icon and make the text direction
horizontal.

Next, right-click on the right-hand side word “Frequency” and choose DELETE. Do the same thing
for the word “Bin” at the bottom of the chart.

Finally, change the bin labels like so.

Your final chart should look like this. You may have to resize it.
12. Now, create a new tab at the bottom of the page by clicking on the plus symbol.

In the new worksheet tab, use the random number generator to create 1,000 random numbers
from a population with mean = 100 and standard deviation = 10. Create a histogram with 31
equally spaced bins. The smallest bin should be 60 and the largest should be 150. The top of
your bin range should look like this:

Instead of typing in the bin range values (60, 63, 66, …, 150) one at a time, use a formula or
other Excel shortcut to expedite the process. Show me your histogram before the end of class to
get credit for the lab. If you finish early, open the NBA.xlsx file from canvas and create a pretty
histogram of 2018-19 player salaries. You will need to choose the number of bins and bin ranges
yourself.

You might also like