WWW | Community | Store | Account | Contact Us
SHAZAM Homepage
Examples to accompany the SHAZAM Reference Manual

For additional examples see:

Manual Examples: R. Carter Hill, William E. Griffiths and Guay C. Lim, 2011.
Contains examples and data to accompany Principles of Econometrics, Fourth Edition, Wiley.

Manual Examples: William Greene, 2011.
Contains examples and data to accompany Econometric Analysis, Seventh Edition, Wiley.

Manual Examples: Jeffrey M. Wooldridge, 2009
Contains examples and data to accompany Introductory Econometrics: A Modern Approach 4e, Fourth Edition, South-Western College Publishing.

Manual Examples: Damodar Gujarati, Dawn Porter, 2008
Contains examples and data to accompany Basic Econometrics, Fifth Edition, Mcgraw Hill.

Manual Examples: R. Carter Hill, William E. Griffiths and Guay C. Lim, 2008.
Contains examples and data to accompany Principles of Econometrics, Third Edition, Wiley.

Manual Examples: R. Carter Hill, William E. Griffiths and George G. Judge, 2001.
Contains examples and data to accompany Undergraduate Econometrics, Second Edition, Wiley.

Manual Examples: William Greene, 2000
Contains examples and data to accompany Econometric Analysis, Fourth Edition, Prentice-Hall.

Chapter 3.   Data Input and Output
rdata.sha Reading character data with the FORMAT command (p. 36).
readchar.sha Reading character data with the CHARVARS= option.
Chapter 4.   Descriptive Statistics
anova.sha A two-way ANOVA table (p. 51).
teststat.sha t-test statistic for differences in population mean and an F-test statistic for different population variances (p. 52).
    Data file : urate.txt     Data file description: urate.html
stemleaf.sha Stem-and-Leaf Display
Chapter 5.   Plots and Graphs
graph.sha Graph of monthly time series data with dates on the x-axis. (p. 56).
    Data file : urate.txt     Data file description: urate.html
Chapter 6.   Generating Variables
log10.sha Working with logarithms to the base 10 (pp. 65-66).
wreplace.sha Sampling Without Replacement (p. 77).
Chapter 7.   Ordinary Least Squares
homeown.sha Weighted Least Squares - Analysis of Proportions Data
Chapter 8.   Hypothesis Testing and Confidence Intervals
hyptest.sha Linear and non-linear hypothesis tests (pp. 104-110).
confid.sha Interval estimation for a population mean (pp. 112-113).
confid2.sha Confidence ellipse for 2 regression coefficients from 2SLS estimation. (pp. 115-116). Also see system.sha.
    Data file : klein.txt
Chapter 9.   Inequality Restrictions
bayes.sha Linear regression with inequality restrictions (pp. 119-121).
sureq.sha SURE with inequality restrictions (pp. 121-122).
Chapter 10.   ARIMA Models
pacf.sha Calculation of the partial autocorrelation function (pp. 127-128).
arima.sha ARIMA estimation - an example from Enders.
arseas.sha Seasonal ARIMA models - examples with the Box and Jenkins airline passenger data set and the Enders Spanish tourism data set.
Chapter 11.   Autocorrelation Models
ar1.sha Estimation and forecasting for a model with AR(1) errors. The commands show how to replicate the estimation results of the AUTO command by using OLS on transformed observations.
Chapter 13.   Cointegration and Unit Root Tests
unitroot.sha Tests for unit roots using the Perron test applied to the Nelson-Plosser data set.
    Data file : nelplos.txt     Data file description: nelplos.html
johansen.prc Johansen trace test procedure for cointegration (pp. 174-177).
    Command file : johan.sha
    Data file : macro.txt     Data file description: macro.html
Chapter 14.   Diagnostic Tests
diagnos.sha Examples of programming test statistics in SHAZAM by illustrating some of the computations implemented by the DIAGNOS command. Calculations for tests for autocorrelation and tests for heteroskedasticity are shown (pp. 182-185).
recur.sha More examples of programming test statistics. Calculations for recursive coefficient estimates and the Hansen test of model stability are shown (pp. 185-188).
reset.sha More examples of programming test statistics. Calculations for RESET tests are shown (pp. 190-191).
Chapter 15.   Distributed-Lag Models
dlag.sha Estimation of distributed lag models including Almon lags (pp. 194-199).
gcause.sha Testing for Granger causality (pp. 199-200).
    Data file : judge18.txt
Chapter 16.   Forecasting
poolfc.sha Forecasting with time-series cross-section data.
Chapter 17.   Fuzzy Set Models
fuzzy.sha Measuring the underground economy using the methodology of Giles and Draeseke (pp. 215-216).
Chapter 18.   Generalized Entropy
gme.sha Example of generalized entropy estimation (pp. 219-222).
Chapter 19.   Generalized Least Squares
glsar1.sha Example of generalized least squares estimation for the model with AR(1) errors (pp. 226-228).
Chapter 20.   Heteroskedastic Models
hetreg.sha Multiplicative Heteroskedasticity
    Data file : credit.txt
Chapter 21.   Maximum Likelihood Estimation of Non-Normal Models
poisson.sha Poisson regression.
mlebeta.sha Models with Beta-Distributed Dependent Variables
    Data file : soss.txt
Chapter 22.   Nonlinear Regression
nlces.sha Estimation of a CES production function and testing for autocorrelated errors (p. 257).
maxfunc.sha Maximizing a function of a single variable (p. 257).
nlsure.sha Nonlinear seemingly unrelated regression applied to the estimation of a linear expenditure system (p. 258).
sysnl.sha N2SLS, N3SLS and GMM estimation applied to Klein's Model I (pp. 260-268). Also see system.sha.
    Data file : klein.txt
        Examples of the LOGDEN option:
mhet.sha Estimation of the multiplicative heteroskedastic error model.
boxhet.sha Maximum likelihood estimation of Box-Cox models with heteroskedasticity.
poisnl.sha Poisson regression. Note that Poisson regression is implemented with the MLE command as shown in the command file poisson.sha.
tobithet.sha Tobit model with heteroskedasticity.
    Data file : mroz.txt
homeown.sha Analysis of Proportions Data
Chapter 23.   Nonparametric Methods
nonpar.sha Nonparametric regression of a nonlinear function (pp. 279-280).
semipar.sha Robinson's semiparametric regression.
Chapter 24.   Pooled Cross-Section Time-Series
pool.sha Estimation methods available with the POOL command (pp. 289-292).
poolfc.sha Forecasting with time-series cross-section data.
poolec.sha Pooling with error components - an example of programming in SHAZAM.
Chapter 25.   Probit and Logit Regression
logit.sha Logit model estimation - comparisons with the probit model are also shown (pp. 300-301).
    Data file : school.txt
probit.sha Probit model estimation and Heckit procedure (pp. 302-304).
    Data file : mroz.txt
logitw.sha Weighted Logit estimation
Chapter 26.   Robust Estimation
lad.sha Least Absolute Error estimation. Calculation of bootstrap standard errors is also shown.
    Data file : industry.txt
Chapter 27.   Time-Varying Linear Regression
fls.sha Flexible least squares simulation experiment from Kalaba and Tesfatsion (pp. 313-314).
Chapter 28.   Tobit Regression
tobit.sha Tobit regression (pp. 321-322).
    Data file : judge19.txt
tobitm.sha Calculating marginal effects for Tobit models including the McDonald and Moffitt (1980) decomposition.
    Data file : judge19.txt
Chapter 29.   Two-Stage Least Squares and Systems of Equations
system.sha Estimation of Klein's Model I by 2SLS and 3SLS (pp. 325-326 and pp. 335-337).
    Data file : klein.txt
hetcov.sha Computation of heteroskedasticity-consistent standard errors for 2SLS estimation.
    Data file : klein.txt
Chapter 30.   Data Smoothing, Moving Averages and Seasonal Adjustment
smooth.sha Seasonal adjustment (p. 342).
expsmth.sha Moving averages and exponential smoothing.
Chapter 31.   Financial Time Series
stock.sha Chart of stock market prices (pp. 349-350).
    Data file : spy.txt
portfol.sha Portfolio selection problem (pp. 353-355).
    Data file : p.txt
eurocall.sha Pricing European call options (pp. 358-359).
bsprice.sha Black-Scholes formula for a call option price, put option price and implied volatility.
Chapter 32.   Linear Programming
lp.sha Linear Programming (pp. 362-364).
Chapter 33.   Matrix Manipulation
matrix.sha Matrix operations (p. 366).
matols.sha OLS estimation with the MATRIX command (p. 370).
Chapter 34.   Price Indexes
prindex.sha Computing price indexes (p. 376).
Chapter 35.   Principal Components and Factor Analysis
pcomp.sha Example of multicollinearity diagnostics and principal components regression (pp. 381-382).
Chapter 36.   Probability Distributions
pvalue.sha Calculating p-values for test statistics (pp. 394-395).
distchi.sha Calculating probabilities for chi-square (p. 395).
distf.sha Calculating probabilities for non-central F (pp. 395-396).
Chapter 37.   Sorting Data
wreplace.sha Sampling Without Replacement (p. 77).
Chapter 40.   Programming in SHAZAM
splice.sha Splicing price index series (p. 417).
power.sha Computing the power of a test (pp. 418-420).
ridge.sha Ridge Regression. (pp. 420-422).
nlsroc.sha Nonlinear least squares by the rank one correction method (pp. 426-427).
mcarlo.sha Monte Carlo experiments (pp. 428-430).
boot.sha Bootstrapping regression coefficients (pp. 430-432).
olscov.sha Estimating the variance of the OLS estimator in the presence of heteroskedastic errors or autocorrelated errors (pp. 432-434).
hausman.sha Hausman specification test for errors in variables (pp. 434-435).
nonnest.sha Non-Nested model testing (pp. 435-438).
solve.sha Solving nonlinear sets of equations (pp. 438-439).
mnlogit.sha Multinomial logit estimation (pp. 440-442).
        More Examples
window.sha Performing a regression with a moving window.
cor.sha Computing p-values for correlation coefficients.
archprog.sha ARCH estimation using Engle's algorithm.
vif.sha Computation of Variance Inflation Factors as an indicator of the severity of multicollinearity.
probelas.sha Computing elasticities from probit estimation when variables have been log-transformed. Also see logit.sha.
    Data file : school.txt
bvprob.sha Bivariate Probit models - Testing for zero error correlation by computing a Lagrange multiplier test statistic.
    Data file : school.txt
fiml.sha Full information maximum likelihood - Klein Model I.
    Data file : klein.txt
Chapter 41.   SHAZAM Procedures
Square root of a matrix (pp. 448-449) using:
  - an eigenvalue-vector decomposition
  - the Golub-Van Loan procedure
    Command file : sqrtm.sha
Black-Scholes option pricing and implied volatility (pp. 451-454).
    Command file : bsvol.sha
Note that Black-Scholes option pricing is implemented with the CALL and PUT commands as shown in the command file bsprice.sha.
liml.prc Limited information maximum likelihood (pp. 454-457).
    Command file : liml.sha
    Data file : klein.txt
multi.prc Generating multivariate random numbers (pp. 457-459).
    Command file : multi.sha
        More Procedures
dwpvalue.prc Calculation of a p-value for the Durbin-Watson statistic
    Command file : dwpvalue.sha
gauss.prc Nonlinear equation estimation by the Gauss-Newton method
    Command file : gauss.sha
granger.prc Testing for Granger causality
    Command file : granger.sha
    Data file : judge18.txt
Granger causality tests are also available using the commands shown in gcause.sha.
huf.prc Robinson's heteroskedasticity of unknown form estimator
    Command file : huf.sha
Solving OLS with the Householder transformation
    Command file : qr.sha
randcoef.prc Random coefficients models - pooled time-series cross-section data.
    Command file : rand.sha
seasroot.prc Tests for seasonal unit roots
    Command file : seas.sha
    Data file : gdpcan.txt
stest.prc Stationarity tests proposed by Leybourne and McCabe
    Command file : stest.sha
    Data file : citibase.txt     Data file description: citibase.html
ols.prc Replication of the SHAZAM OLS command.
    Command file : ols.sha

A Note on using SHAZAM Procedures

SHAZAM command files that use SHAZAM procedures may need a revision to the FILE PROC command. This is required to ensure that the procedure file can be located. Further details are in the chapter SHAZAM PROCEDURES.

Run SHAZAM over the Internet

The SHAZAM examples can be run over the internet from the link on the SHAZAM homepage.

Data files can be loaded with the READ command:

   READ (data/filename) variable_list / OPTIONS

where filename is the name of the data file and variable_list is the list of variable names.

SHAZAM procedures can be located by using:

   FILE PROC procs/proc_name

where proc_name is the name of the procedure file.

Upper and lower case are not interchangeable for filenames.