Title: Spatial Econometric Analysis Using GAUSS
1Spatial Econometric Analysis Using GAUSS
- 2
- Kuan-Pin LinPortland State University
2GAUSSMathematical and Statistical System
- Windows Interface
- Windows
- Command, Error, Log,
- Menu
- File, Edit, Run, , Help
- Operation
- Interactive Mode
- Command (Input / Output)
- Batch Mode
- Writing Program
- Online Help
3GAUSS Basics
- Basic Operations on Matrices - . ./
! / .lt .lt . .gt .gt ./
lt lt gt gt / .not .and .or
.xor not and or xor .. - Special Operators . '(transpose)
- Useful Algrbra and Matrix Operations exp ln
log abs sqrt pi sin cos inv invpd(inverse)
det(determinant) - Example
- Least Squares by/x
4GAUSS ProgrammingUseful GAUSS Functions
- System Functions use, load, output
- Data Generating Functionsones, zeros, eye,
seqa, seqm, rndu, rndn - Data Conversion Functionsreshape, selif, delif,
vec, vech, xpnd, submat, diag, diagrv - Basic Matrix Functions
- Matrix Descriptionrows, cols, maxc, minc,
meanc, median, stdc - Matrix Operationssumc,cumsumc,prodc,cumprodc,sor
tc,sorthc,sortind - Matrix Computationdet,inv,invpd,solpd,vcx,corrx,
cond,rank,eig,eigh - Probability and Statistical Functionspdfn,
cdfn, cdftc, cdffc, cdfchic, dstat, ols - Calculus Functionsgradp, hessp, intsimp,
linsolve, eqsolve, sqpsolve
5GAUSS ProgrammingControlling Execution Flow
- If Statementif then else elseif endif
- For Loopfor i (start,stop,step) ... endfor
- Do Loopdo while ... endodo until ... endo
6GAUSS ProgrammingWrite Your Own Functions
- Single Line Functionfn fn_name(args)
code_for_function - Procedureproc (nrets) proc_name(arg_list)l
ocal list of local variables... statements in
the body of procedureretp(ret_list)endp
7GAUSS ProgrammingExample 1
- Do you know the accuracy of your computer's
numerical calculation? This example addresses
this important problem. Suppose e is a known
small positive number, and the 5x4 matrix X is
defined as follows - Verify that the eigenvalues of X'X are 4e2, e2,
e2, and e2. How small of the value of e your
computer will allow so that X'X can be inverted?
(example.1)
oneones(1,4) e1.0 do until e lt 1.0e-20 xone(e.eye(4)) print "e " e reigrs(x'x) print r' invxinvpd(x'x) print invx ee/10 endo
8GAUSS ProgrammingExample 2
- Write a single-line GAUSS function to convert a
quarterly time series into the annual series by
taking the average of every four data points. How
you extend the single-line version of time series
conversion function to a multi-line procedure so
that it can handle the conversion of more than
one time series? (example.2)
fn qtoa1(x) meanc(reshape(x,rows(x)/4,4)')
proc qtoa(x) local r,c,y,i r rows(x) c cols(x) y qtoa1(x.,1) i 2 do until i gt c y yqtoa1(x.,i) i i1 endo retp(y) endp
9GPE2 for GAUSS
- GPE2 is a package of econometric procedures
written in GAUSS. There are four main functions,
driven by a set of global control variables - ResetSet up global control (input and output)
variables. - EstimateEstimation of a linear or generalized
linear model. - ForecastForecasting based on a linear or
generalized linear model. - OptimizeEstimation of a nonlinear model.
- GpehelpOnline help of using GPE2.
10GPE2 for GAUSSSelected Global Control Variables
- Input Control Variables_names, _begin, _end,
_rstat, _rtest, _rplot, _rlist,_const, _restr,
_vcov, _hacv, _weight, _ivar, _dlags, _pdl, _eq,
_id, _ar, _ma, _arma, _garch, _acf, _acf2,
_nlopt, _method, _iter, _tol, _step, _conv,
_fbrgin, _fend, _fstat, _fplot, _splag, _spw,
_spwd - Output Control Variables__y, __x, __e, __b,
__vb, __v, __rss, __r2, __f, __vf, __t, __a, __va
11GPE2 for GAUSSA Typical Program Using GPE2
- /
- Comments on program title, purposes, and the
usage of the program - /
- use gpe2 _at_ using GPE package (version 2) _at_
- // this must be the first executable statement
- /
- Writing output to file or sending it to
printer - specify file name for output
- /
- // Loading data read data series from data
files. - /
- Generating or transforming data series
- create and generate variables with data
scaling or transformation - (e.g. y and x are generated here and will be
used below) - /
- call reset _at_ initialize global variables _at_
- /
- Set input control variables for model
estimation - (e.g. _names for variable names, see Appendix
A)
12GPE2 for GAUSSExamples
- More than 70 examples covering linear and
nonlinear least squares, instrumental variables,
system of simultaneous linear equations, time
series analysis, panel data, limited dependent
variables, maximum likelihood, generalized
methods of moments, and - The latest extensions include spatial lag model
estimation, hypothesis testing, and robust
inference.
13Software Demonstration
- Installation
- GAUSS Light 10.0
- GPE2 for GAUSS 10.0
- Example Zellner and Revankar 1970U.S.
Transportation Equipment Industry - Cobb-Douglas Production Functionln(Q) a b
ln(L) g ln(K) e - Generalized Cobb-Douglas Production
Functionln(Q) q Q a b ln(L) g ln(K) e
14ExampleZellner and Revankar 1970
- Cobb-Douglas Production Function
- OLS Estimator
- Hypothesis Testing
- Constant Returns to Scale?
- Homoscedasticity?
- Generalized Production Function
- Output Effects?
- Instrumental Variables
- GAUSS/GPE2 Program and Data
15References
- K.-P. Lin, Computational Econometrics GAUSS
Programming for Econometricians and Financial
Analysts, ETEXT Publishing, Los Angeles, 2001. - C.-F. Chung, Learning Econometrics with GAUSS,
Institute of Economics, Academia Sinica, 2000. - A. Zellner and N. Revankar, "Generalized
Production Functions," Review of Economic
Studies, 1970, 241-250.