STAT 201-Chapter 2
LAB Tutorial
Q5/page 25. Wellstone Inc. produces and markets replacement covers for cell
phones in five different colors: bright white, metallic black, magnetic lime,
tangerine orange, and fusion red. To estimate the demand for each color, the
company set up a kiosk in the Mall of America for several hours and asked randomly
selected people which cover color was their favorite. The results follow:
a. What is the table called?
b. Draw a bar chart for the table.
c. Draw a pie chart.
• Frequency Table: a grouping of qualitative data into mutually exclusive classes showing
the number of observations in each class. The above table is an example of frequency table,
as it groups sample data into different classes of cell phone cover colors and it sumamrize
the number of persons that prefer their color( frequency of each class)
Pie Chart:
A chart that shows the Proportion or Percentage that each class represents of the total number of
frequencies.( Relative Frequency of each class)
Relative Frequency of each class is calculated by using following formula= frequency of the
class/ Sum of frequency of all classes
İn this example the relative frequency of each class is calculated in the following table.
Cell Phone Covers Frequency Relative Frequency
White 130 (130/1300)=0.1=10%
Black 104 (104/1300)=0.08=8%
Lime 325 (325/1300)=0.25=25%
Orange 455 (455/1300)=0.35=35%
Red 286 (286/1300)=0.22=22%
1,300 100%
1
Page
Pie chart illustrates the relative frequency for each class , so the color with highest relative
frequency( which is orange) will have the highest share of the pie chart.
• Bar chart: A graph that shows the Qualitative Classes on horizontal (x) Axis and class
frequencies on the Vertical(y) axis. The class frequencies are proportinal to the height of
the bars.
In Excel we use the PivotTable Wizard to create the frequency table, relative frequency table,
bar chart, and pie chart for different types of data.
Step1- create Frequency table for “Vehicle Type” variable
The Steps to create the frequency table for “Vehicle Type”, for Applewood Auto Group data on
page 22 are the following:
a. Open the Applewood Auto Group data file.
b. Click on a cell somewhere in the data set, such as cell C5.
c. Click on the Insert menu on the toolbar. Then click PivotTable on the far left of the Ribbon.
d. The following screen will appear.
• Click on “Select a table or range” to select the data range as shown in the Table/Range
row.( all rows and columns that contain data much be selected)
2
• Next, click on “Existing Worksheet” and select a cell location, such a N1, and click OK.
Page
When you click ok, On the right-hand side of the spreadsheet, a PivotTable Field List will appear
which is a listing of the data set variables( such as Age,Location, Vehicle Type, Profit,..)
In this example as we are aiming to draw a frequency table for The Variable “Vehicle Type”
therefore we need to Specify for excel to summarize the data based on the “Vehicle Type” variable.
• To summarize the “Vehicle-Type” variable, you need to click on the “Vehicle-Type”
variable from the PivotTable Field List, by doing the selected variable “Vehicle Type”
will appear in the lower left box called Row Label.
• -Next, return to the top box(PivotTable Field List) , and select and drag the “Vehicle-
Type” variable to the “Σ Values” box at the bottom of pivot table wizard. After doing this,
A column of frequencies will be added to the Pivot table that is generated by excel. As we
used the sum function, the pivot table that is created is a frequency table.
Note that you can format the table to center the values and also relabel the column headings as
needed.
➢ Step 2: Create Bar Chart by using the “PivotTable” for “Vehicle Type” variable
To create the bar chart from the frequency table created, select any cell in the PivotTable created.
>>>Next, select the Insert menu from the top tool bar>>>> within the Charts group, select a bar
chart from the Column dropdown menu>>>> A bar chart appears.
You can add chart elements such as “axis labels “ and “title” to the Bar Chart as needed by using
the option” add chart elements”
➢ Step 3: Create Pie Chart by using the “PivotTable” for “Vehicle Type” variable
To create the pie chart, we need to convert the values in our PivotTable to a relative frequency.
To make such conversion of frequency to relative frequency we follow the following steps:
Click in the body of the “PivotTable” and the PivotTable Field List will appear to the right>>>>
In the “Σ Values” box, click on the pull-down menu for “Count of Vehicle Type” and select the
Value Field Settings option>>>> a window will be opened that shows a number of different
selections that can be used to summarize the variables in a PivotTable>>>in this window Click
on the tab “Show Values As” and, go to the pull-down menu, and select the option“% of Grand
Total.” And click OK. >>>The frequencies will be converted to relative frequencies.
3
In the next step, we will draw a Pie chart by using the relative frequency table that is given to us
Page
in PivotTable, the steps are:
select any cell in the PivotTable(relative frequency table)>>> select the Insert menu from the top
tool bar, and within the Charts group, select a pie char>>>> A pie chart appears.
Click on the chart heading and label the chart as needed. To add the percentages, click on the pie
chart and a menu will appear. Click on “Add Data Labels.”
Now we want to use PivotTable Wizard in Excel to create the frequency and relative frequency
distributions & Histogram for the Profit Variable of sales of AppleWood Auto group:
• Frequency Distribution: A grouping of quantitative data into mutually exclusive and
collectively exhaustive classes showing the number of observations in each class.
• Histogram: a graph in which classes are marked on the horizontal axis and the class
frequencies on the vertical axis, the class frequencies are represented by the heights of the
bars, and the bars are drawn adjacent to each other.
“ histogram is drawn for quantitative data and it looks similar to a bar chart which we have drawn
for qualitative data but the distance between bars is zero in the histogram because quantitative data
is continuous”
Step 1: Create Pivot table for the “Profit table”
we are trying to summarize the “Profit” variable so we will repeat the same procedures we did for
vehicle type above but instead of selecting “vehicle type” as our variable of interest in pivot table
wizard we select the “Profit” variable and drag it to the “Row Labels” box>>>>
Then return to the top box of pivot table wizard on right bar, click on “Profits” again and drag it
to the “Σ Values”box>>>>Staying in the “Σ Values”box, click on value field settings on “Sum
of Profit.”>>> a window will be opened that lists a number of different selections that can be
used to summarize the profit variable in a PivotTable.>>>In the window go to “Summarize
Values As” tab, and select “Count” to create frequencies for the variable “Profit.” >>>>excel
created a PivotTable for the profit variable.
Step 2: Create “Frequency Distribution” for the “Profit” Variable
In this step we want to draw a frequency distribution for our quantitative variable(profit), follow
this steps to transform the” PivotTable” created in step 1 into frequency distribution for the “profit”
variable:
To create frequency distribution we need to create classes for “Profit,” to do this follow the
following steps:
Select any cell in the “Profit column “of the Pivot table and right-click and Select “Group” from
the menu to create the classes.
4
in the dialogue box that appears, enter the values as the following:
Page
➢ -“Starting at” is the lower limit of the first class, enter its value as 200.
➢ -“Ending at” is the upper limit of the last class, enter its value as 3,400.
➢ -“By” value is the clas size , enter 400 for class size.
Click OK. A frequency distribution appears.
Step 3: Create “Relative Frequency Distribution” for the “Profit” Variable
click on one of the cells in the PivotTable >>> the “PivotTable Field List” appears to the right.
Click and drag the variable “Profits” to the “Σ Values” box, by doing this, A second series called
a “Counts of Profit 2” appears In the “Σ Values,”>>> click on “Counts of Profit2” in “Σ Values,”
field and click on its “Value Fields Setting.” >>>Again a window appears that shows a number
of different selections that can be used to summarize the “count od profit 2” >>>>go to “Show
Values As” tab in this window and from a pull-down menu, select “% of Grand Total.” >>>
A column for The relative frequencies is now added to the pivot table which is the relative
frequency distribution.
You can format the Pivot table by relabeling the column headings such as “Frequency” and
“Relative Frequency.”
Step 4: Create a histogram for the “Profit variable” based on the frequency distribution
To create a histogram, select a cell in the PivotTable>>>go to the Insert menu from the tool bar,
and within the Charts group, select a column chart from the Column drop-down menu>>>> A
column chart appears including the two series in your pivot table namely “Count of Profit” and
“Count of Profit2.” Because we don’t need the relative frequency in our histogram, we need to
remove the series which is related to relative frequencies, to do this we follow these steps:
>>>Right-click on the “Count of Profit2” bubble at the top of the chart>>> select “Remove
Field.” Then the chart and PivotTable only report the frequencies.
To eliminate the space between the bars and transform the bar chart to histogram, select the series
in the chart area and reduce depth to zero to remove gaps between bars
To add data labels to your histogram, select the histogram, right-click, and select “Add Data
Labels.” Relabel the chart and axes as needed
5
Page