Econometric Computing with Gauss KuanPin Lin Econometric Computing
- Slides: 17
Econometric Computing with Gauss Kuan-Pin Lin
Econometric Computing with GAUSS l Why GAUSS? l l l Matrix/Array-Based Computation Loosely Structural Programming Environment 500 -Plus Built-In Functions Use of Libraries and Packages Frontier Research: Implementation of New Methods and Algorithms Other Alternatives l SAS, Stata, Mat. Lab, R, …
GAUSS Mathematical and Statistical System l GAUSS 12 Windows Interface l Pages l l Windows l l File, Edit, Tool, … Toolbars l l Command Input, Program Output, … Menus l l Command, Source, Data, Debug, Help Run, Debug, Edit, … Operation l l Interactive Mode: Using Command Page Batch Mode: Using Source Page
GAUSS Basics l Basic Operations on Matrices + ^. >=. >. not. and. *. *~ l Special Operators [] l . *. / %. /= <. or. xor {} : . ! * /. < <= == >= not and or exp ln log abs sqrt pi sin cos invpd(inverse) det(determinant) l Example l > /= xor ~ '(transpose) Useful Algrbra and Matrix Operations Least Squares: b=y/x . <= inv . == |
GAUSS Programming Useful GAUSS Functions l l System Functions: use, load, output Data Generating Functions: ones, zeros, eye, seqa, seqm, rndu, rndn Data Conversion Functions: reshape, selif, delif, vech, xpnd, submat, diagrv Basic Matrix Functions: l l l Matrix Description: rows, cols, maxc, minc, meanc, median, stdc Matrix Operations: sumc, cumsumc, prodc, cumprodc, sorthc, sortind Matrix Computation: det, invpd, solpd, vcx, corrx, cond, rank, eigh Probability and Statistical Functions: pdfn, cdftc, cdffc, cdfchic, dstat, ols Calculus Functions: gradp, hessp, intsimp, linsolve, eqsolve, sqpsolve
GAUSS Programming Controlling Execution Flow l If Statement if; then; elseif; endif; l For Loop for i (start, stop, step); . . . endfor; l Do Loop do while. . . endo; do until. . . endo;
GAUSS Programming Write Your Own Functions l Single Line Function fn fn_name(args) = code_for_function; l Procedure proc [[(nrets)=]] proc_name(arg_list); local list of local variables; . . . statements in the body of procedure; retp(ret_list); endp;
GAUSS Programming Example 1 l 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 5 x 4 matrix X is defined as follows: one=ones(1, 4); e=1. 0; do until e < 1. 0 e-20; x=one|(e. *eye(4)); print "e = " e; r'; e 2. How small Verify that the eigenvalues of X'X r=eigrs(x'x); are 4+e 2, print e 2, and print invx; of the value of e your computer willinvx=invpd(x'x); allow so that X'X can be e=e/10; inverted? (example 1. 1) endo;
GAUSS Programming Example 2 l 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 fnaqtoa 1(x) = meanc(reshape(x, rows(x)/4, 4)'); function to multi-line procedure so that it can handle the proc conversion of qtoa(x); more than one time series? (example 1. 4) local r, c, y, i; r = rows(x); c = cols(x); y = qtoa 1(x[. , 1]); i = 2; do until i > c; y = y~qtoa 1(x[. , i]); i = i+1; endo; retp(y); endp;
Using Library and Package l Publication Quality Graphics (PQG) Library l Example: Using GAUSS to present and solve the following functions: l l f(x) = ln(x) - x 2 Hint: The maximal of f(x) is found at x = or 0. 707. (Program). g(x) = (x 12 + x 2 - 11)2 + (x 1 + x 22 -7)2 Hint: There are four minima: (3, 2), (3. 5844, -1. 8481), (-3. 7793, -3. 2832), ( -2. 8051, 3. 1313). (Program). Commercial Packages: CML, CO, FANPAC, etc. GPE 2 for GAUSS
GPE 2 for GAUSS l GPE 2 is a package of econometric procedures written in GAUSS. There are four main functions, driven by a set of global control variables: l l l Reset Set up global control (input and output) variables. Estimate Estimation of a linear or generalized linear model. Forecasting based on a linear or generalized linear model. Optimize Estimation of a nonlinear model. Gpehelp Online help of using GPE 2.
GPE 2 for GAUSS Selected Global Control Variables l 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 2, _nlopt, _method, _iter, _tol, _step, _conv, _fbrgin, _fend, _fstat, _fplot, _splag, _spwd l Output Control Variables __y, __x, __e, __b, __v, __rss, __r 2, __f, __vf, __t, __a, __va
GPE 2 for GAUSS A Typical Program Using GPE 2 l l l l l l l l /* ** Comments on program title, purposes, and the usage of the program */ use gpe 2; @ using GPE package (version 2) @ // 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; @ initialize global variables @ /* ** Set input control variables for model estimation ** (e. g. _names for variable names, see Appendix A) */ call estimate(y, x); @ do model estimation @ // variables y, x are generated earlier /* ** Retrieve output control variables for model evaluation and analysis */ /* ** Set more input control variables if needed, for model prediction ** (e. g. _b for estimated parameters) */ call forecast(y, x); @ do model prediction @ end; @ important: don’t forget this @
GPE 2 for GAUSS Examples l l 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.
Software Demonstration l Installation l l l GAUSS Light 12. 0 GPE 2 for GAUSS 12. 0 Example: Zellner and Revankar [1970] U. S. Transportation Equipment Industry l l Cobb-Douglas Production Function ln(Q) = a + b ln(L) + g ln(K) + e Generalized Cobb-Douglas Production Function ln(Q) + q Q = a + b ln(L) + g ln(K) + e
Example Zellner and Revankar [1970] l Cobb-Douglas Production Function l l OLS Estimator Hypothesis Testing l l l Generalized Production Function l l l Constant Returns to Scale? Homoscedasticity? Output Effects? Instrumental Variables GAUSS/GPE 2 Program and Data
References l l l 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.
- Methodology of econometrics
- Gauss–jordan elimination
- Faradayın buz kovası deneyi
- Conventional computing and intelligent computing
- Joint sentiment topic model for sentiment analysis
- Yong loo lin school of medicine
- Xuemin lin unsw
- Ram nam me lin hai dekhat sabme ram
- Modelo lin log
- [email protected]
- Kimmy lin
- Ellen lin
- Inverse compositional spatial transformer networks
- Huei-yung lin
- Donn lin
- Mary lin elementary
- Semantic roles
- "dts" "professor"