Introduction to Stataquest
Econ 253
The notion that there might be a trade-off between unemployment and
inflation is well known. The perception is that if the government tries
to reduce inflation by contractionary monetary and fiscal policy, then
unemployment will surely rise. Thus one would expect a negative correlation
between unemployment and inflation. This relationship is known as the Phillips
curve. The file phillips.txt contains annual
data for the U.S. on unemployment and inflation rates and wage growth.
The source of the date is the 1996 Economic Report of the President. The
file has 5 variables:
year = 1959-95
unemp = Civilian unemployment rate (%), Table
B-38
cpi = Consumer price index (1982-84
= 100), Table B-56
infl = Percent change in CPI (inflation
rate) calculated as 100*[CPI(t) - CPI(t-1)]/CPI(t-1)
wggr = index of average weekly earnings
in current dollars, 1959=100 , Table B-43
-
Download the data and load them into stataquest.
-
Compute summary statistics for inflation and unemployment.
-
Scatter plot inflation and unemployment.
-
Compute the correlation coefficient between unemployment and inflation
for the whole sample.
-
Compute the correlation for the periods 1959-1970, 1971-1980, 1981-1995.
Has the relationship changed over the decades?
-
Calculate growth rate in nominal wage and redo the analysis using the wage
growth instead of the inflation rate.
Instructions:
- Stata is a very powerful and widely used statistical software. The Windows
95 version of Stataquest is available on a diskette at the back of the Stata
Quest 4 manual. This handout has a brief overview. Stataquest is relatively
easy to use, because it is menu-driven, and almost everything is done by pointing
and clicking. Below are the basic instructions to get you started.
- If you are using the computers in Jesup, double click on the StataQuest
icon or click Start, Programs, Stataquest. To install on your own computer
put in the diskette, double click on a:setup.exe and follow instructions.
- Stataquest has three four default windows: "Commands," "Variables," 'Results,"
and "Review." Commands can either be typed into the Commands window or called
using the menu on top of the screen. The list of variables in the data set
appears in the "Variables" window, and "Review" contains all the commands
entered. The results of the statistical analysis appear in the "Results" window.
- Stataquest allows you to maintain a log file, which is a record of your
work. Always start by opening a log file. Click the log button, enter a name
in the dialog box (*.log), and click open.
- Save phillips.txt on your hard drive or a diskette
and use commands FILE, IMPORT ASCII to load the data into stataquest.
- Notice that the Review box contains a record of the commands you have executed,
and the Variables box lists the variables in your data set.
- Use SUMMARIES, MEANS AND SDs.
- Use GRAPH, SCATTERPLOTS.
- Use STATISTICS, CORRELATIONS, PEARSON.
- There are several ways to perform your analysis on subsamples. One way
is to delete observations that are outside your subsample and calculate correlations.
Another way is to use the command window and type the correlation command
with a qualifying "if" statement. For example to calculate the correlation
for subsample you would type: "pwcorr infl unemp if (year<1981 & year>1970)"
- STATA indexes observations with variable _n. The lagged value of
wgindex is in wgindex[_n-1]. Calculate the wage growth using DATA, GENERATE/REPLACE,
FORMULA, enter the name of the new variable(e.g. wgrowth) and the formula
"(wgindex-wgindex[_n-1])/wgindex[_n-1]".
- You can now save your data in a special format convenient for Stataquest.
Choose File, Save As. In the Dialog box enter a name for the data set. The
name must be of the form *.dta.. To use this saved data set at a later time,
click File, Open, and choose the appropriate data set.
- You can now check that a record of all your work has been kept, by clicking
the log button, choosing Bring log Window to the Top, and clicking OK. Click
the log button, and choose Close log file. All your work will have been saved
in the log file you had earlier specified.