Lab 9:
Dummy Variables and Data Manipulations
Objectives:
This lab will introduce you to data manipulations in
Minitab
, especially the creation of
dummy variables
and
interaction variables
.
We’ll then use one of the most common data transformations in econometrics – creating
natural logarithms of variables. You should recall that we did this using Excel in Lab 7.
Data
:
Same data used last week:
ROSES.xls
x; or
Roses.dat
(an ASCII data set). If you saved your
Minitab
project for Lab 8, you can open
Minitab
, and then open your
Minitab
Project.
♦
Creating Dummy Variables
.
1.
Dummy variables are binary variables (they take on only two values) that indicate whether a condition,
characteristic, or quality exists for a specific observation. The observation could be a person, a car, or a
year and quarter as we’ll analyze here.
2.
We could create dummy variables in our Excel file using the “
=If(.
.)
” function.
Try it.
Create a new
column in the Excel spreadsheet, call it Q1. Our variable will indicate whether the
quarter
is quarter 1 or
not. The syntax is:
“
=IF(logical_test,[value if true],[value if false]
.”
For these data, in the first cell, for
1971, quarter 3, the function is: “=
IF(B2=1,1,0)
”.
This will place a “1” in all cells where the variable
quarter
= 1, and will return a “0” for all other values of
quarter
.
3.
We can also use
Minitab
to create dummy variables for us for this exercise. First, load the
Roses
data. The
data are on the server as an ASCII file (we used these in Lab 8). Or, you can copy and paste the data from
the Excel spreadsheet. Copy both data and names, but make sure you get the names pasted into the first row
in
Minitab
where the names belong (the cells are shaded beige/gray in the
Minitab
worksheet).
4.
Check the data by
calculating descriptive statistics (means, standard deviations, medians, minimums
and maximums) for the variables:
sales, prose, pcarn,
and
income
.
You should observe the same results
that we obtained last week.
Copy these to a
Word
file
.
5.
Next we need to create dummy variables for the different quarters. You could simply type the appropriate
dummy variables into the worksheet. But there is an easier way: Let
Minitab
do it!
In the menu under
C
alc
, you will find
Make I
ndicator Variables…
When you ask
Minitab
to
create indicator variables
for
a variable in your data set,
Minitab
will check the variable and find out how many different values there
are. It only makes sense to create indicator variables for
categorical variables
(variables with a limited
number of discrete values). The variable
quarter
has 4 different values denoting the quarter of the year.
Thus,
Minitab
will create 4 dummy variables, one for each quarter, of the form:
1;
1, 2, 3, 4 .
0.