## C. Cameron, Dept. of Economics, Univ. of Calif.-Davis

http://www.econ.ucdavis.edu/faculty/cameron  has further information on how to use Shazam.

This particular help sheet provides

introduction to Shazam use for basic regression

SHAZAM ACCESS

Shazam comes in both PC and mainframe versions.
This handout is for PC version, but little change is needed for mainframe version.

Shazam can be run either in interactive mode (you give one Shazam command and wait for response before giving the next) or in batch made (you give a file of Shazam commands  which are all processed at once).

In what follows it is assumed that you are already in Shazam, in interactive mode.

SHAZAM INTRODUCTION

Saving output

The first SHAZAM command you give should be
FILE SCREEN pathname

Here pathname is the name of a file, e.g. A:\MYOUTPUT.OUT.
This command puts the output in a file, as well as simulataneously displaying it on the screen. When you have finished your Shazam session, edit this file using a text editor and print out useful output.

Shazam Help

To get a list of Shazam commands, give the Shazam command
HELP

To get help on a particular comand, e.g. FILE, give a Shazam command such as
HELP FILE

Generate Data

We first read in and/or create data.
For simplicity here we will create data (later on we consider how to read in data).

We will create a sample with 50 observations.
The variable X will take value 1 for the first observation, 2 for the second observation, ... , 50 for the fiftieth observation.
The variable Y will equal 10 + 0.1*X + u, where u is a random draw from the standard normal distribution.

The Shazam commands to do this are
SAMPLE  1  50
GENR  X = TIME(0)
SET  RANFIX
GENR  Y = 10 + 0.1*X + NOR(1)

The first line sets the sample size to 50 observations.
The second line creates the first observation of X as 0+1 = 1, ...., the fiftieth as 0+50 = 50
The fourth lines sets Y equal to 10 + 0.1*X plus a random draw from the standard normal distribution.
The third line is not obvious. It is used so that subsequent runs of the same program will give the same NOR(1) draws and hence create the same Y.

Descriptive Statistics

Given the above we know that X has sample mean of 25.5 (recall it ranges from 1 to 50).
And Y is a random variable with population mean 10 + 0.1*25.5 = 12.55.

The Shazam command to get the sample mean, as well as the sample variance and other descriptive statistics for the data is
STAT  Y  X

Key Shazam output from this command includes

 NAME N MEAN STDEV VARIANCE Y 50 12.426 1.8746 3.5143 X 50 25.5 14.577 212.50

Plots

To plot the data with Y on the vertical axis and X on the horizontal axis give the Shazam command
PLOT  Y  X

OLS Regression

The regression model  is      Y = b1 + b2*X + u

For this created data set we know b1 = 10, b2 = 0.1, and u is normally distributed with mean 0 and variance 1. We therefore expect an estimated intercept of approximately 10, an estimated slope coefficient of approximately 0.1, and estimated standard error for the regression of approximately 1.

The Shazam command for OLS regression is
OLS  Y  X

Key Shazam output from this command includes R-SQUARE = .7553

 VARIABLE ESTIMATED STANDARD T-RATIO NAME COEFFICIENT ERROR 45 DF X 0.11176 .91815E-02 12.173 CONSTANT 9.5759 0.26902 35.596

TYPING IN DATA

If the data set has only a few observations in can be typed in by hand.
For example, consider the following data on annual salary (in thousands of dollars) and gender (1 if male and 0 if female) for a sample of 5 workers

 SALARY GENDER 21 0 41 1 52 1 18 0 20 1

This data can be read in using the Shazam commands
SAMPLE  1  5
21  0
41  1
52  1
18  0
20  1

To see that the data are read in properly, give the Shazam command
PRINT  SALARY  GENDER

READING IN DATA FROM EXTERNAL FILE

More common is to read data in from a file.  This saves retyping the data in each time Shazam is run.

Suppose the preceding data are put in a file c:\myprogs\shazam1.dat, which has 21  0  on the first line, ..., and  20  1  on the fifth line. Then the following SHAZAM commands read in and analyze this data
FILE  11  C:\MYPROGS\SHAZAM1.DAT
PRINT  SALARY  GENDER
OLS  SALARY  GENDER

The first line assigns unit 11 to the data file, here c:\myprogs\shazam1.dat (with other examples and data sets it is safest to continue to use unit 11).
The second line reads in the data on unit 11 (and hence by association c:\myprogs\shazam1.dat). Shazam responds with a statement that 5 observations have been read in.
The third line is a check that data is read in correctly. This should always be done, unless the data set is large, in which case the STAT command can be used as a partial check.
The fourth line produces OLS estimates including

 VARIABLE ESTIMATED STANDARD T-RATIO NAME COEFFICIENT ERROR 3 DF GENDER 18.167 12.170 1.498 CONSTANT 19.500 9.2466 2.0680

Thus men earn much more on average than women (18.167 or \$18,167 per year more), though this is not statistically significant at 5% given the t-ratio of 1.498.  (For a one-sided test at 5% the critical value from t(3) table is 2.353).

The READ command given above assumes the data are separated by blanks.
A more complicated form of the Shazam READ command uses the FORMAT statement.

BATCH MODE

This may not work on the lab version of Shazam. Suppose all the Shazam commands are entered into a file.
For example, the file c:\myprogs\shazam1.shz might include the Shazam commands
FILE  11  C:\MYPROGS\SHAZAM1.DAT