econ 4160: econometrics{modelling and systems estimation€¦ · introductioneconometric software...

23
Introduction Econometric software menu Review of elementary econometrics using OxMetrics ECON 4160: Econometrics–Modelling and Systems Estimation: Computer Class Ragnar Nymoen, August 29 th , 2011 Department of Economics, University of Oslo Revised by Andr´ e K. Anundsen, 17 th August, 2012 ECON 4160: Computer Class Department of Economics, University of Oslo

Upload: others

Post on 19-Oct-2020

14 views

Category:

Documents


0 download

TRANSCRIPT

  • Introduction Econometric software menu Review of elementary econometrics using OxMetrics

    ECON 4160: Econometrics–Modelling andSystems Estimation:

    Computer Class

    Ragnar Nymoen, August 29th, 2011

    Department of Economics, University of Oslo

    Revised by André K. Anundsen, 17th August, 2012

    ECON 4160: Computer Class Department of Economics, University of Oslo

  • Introduction Econometric software menu Review of elementary econometrics using OxMetrics

    Practical information

    Who am I? → André K. Anundsen (PhD-student)Email: [email protected]: 1143Responsible for the CPU class + the seminar series

    ECON 4160: Computer Class Department of Economics, University of Oslo

  • Introduction Econometric software menu Review of elementary econometrics using OxMetrics

    Aims and purpose I

    I Use computer program to learn about:1. Econometric theory

    I Complementary and supplementary to the lectures

    2. Applied econometricsI Integrated with the seminar series

    ECON 4160: Computer Class Department of Economics, University of Oslo

  • Introduction Econometric software menu Review of elementary econometrics using OxMetrics

    Aims and purpose II

    I In the CPU class, we will demonstrate the implications of thetheoretical results established in the lectures through MonteCarlo simulations, and we will apply the methods you learn toreal-world data!

    I To each seminar, you will be given a set of exercises. Theexercises are of two types:

    I Applied modeling tasks, where you use your (theoretical)econometric skills in combination with the skills you acquire inthe computer class to analyze real-world data. You will thenhold a live computer presentation of your solution proposal atthe seminar

    I The other type of seminar exercises will be more theoreticaland algebraic, establishing results that are extremely importantto have in mind when analyzing a data set

    ECON 4160: Computer Class Department of Economics, University of Oslo

  • Introduction Econometric software menu Review of elementary econometrics using OxMetrics

    As noted by Greene, many powerful program packages andprogram languages are in use in econometric research and inapplied projects:

    I EViews

    I Gauss

    I LIMDEP

    I MATLAB

    I NLOGIT (LIMDEP)

    I RATS (including CATS in RATS)

    I SAS

    I Shazam

    I StataI TSP

    ECON 4160: Computer Class Department of Economics, University of Oslo

  • Introduction Econometric software menu Review of elementary econometrics using OxMetrics

    I MicroFit

    I OxMetrics, which includes PcGiveI ForecastPro

    I Troll

    I Time Series Modelling (TSM)

    and probably many more

    ECON 4160: Computer Class Department of Economics, University of Oslo

  • Introduction Econometric software menu Review of elementary econometrics using OxMetrics

    The above programs are licensed commercial products, thoughdeveloped from research projects...

    Also exist “freeware ”and “open source ”programs:

    I R

    I Gretl

    I Scilab

    ECON 4160: Computer Class Department of Economics, University of Oslo

  • Introduction Econometric software menu Review of elementary econometrics using OxMetrics

    How do I choose which one to use? I

    I Ease and accuracy of data loading, data storage and resultreporting

    I The data is often your most valuable asset, so:I Getting the data into the program is an essential step!I Basic reporting is very similar between programs, but not

    standard! Reporting for typesetting (e.g., LATEX) is still rare.PcGive has some, Stata is better

    ECON 4160: Computer Class Department of Economics, University of Oslo

  • Introduction Econometric software menu Review of elementary econometrics using OxMetrics

    How do I choose which one to use? II

    I Menus, batch language and programming capabilityI Menus are good for getting started, and for demonstrationsI Batch language is important for

    1. Efficient work (once you become an “expert”)2. Documentation (colleagues, yourself and journals!)3. Communication (e.g., between supervisor and yourself)

    I Programming capability can be important to increaseflexibility (can’t always do “everything ”using menus andbatch language)

    ECON 4160: Computer Class Department of Economics, University of Oslo

  • Introduction Econometric software menu Review of elementary econometrics using OxMetrics

    How do I choose which one to use? III

    I The purpose of your project!I Econometric programs are like (specialized) tools: They are

    designed to do specific tasks efficientlyI Each program has its strengths and weaknessesI Unless you are very specialized yourself, you will probably end

    up using more than one program

    ECON 4160: Computer Class Department of Economics, University of Oslo

  • Introduction Econometric software menu Review of elementary econometrics using OxMetrics

    Why do we use OxMetrics/PcGive in this course?

    I OxMetrics is a powerful package including an option toestimate all models we consider in this course (particularlygood at simultaneous equation systems! Give = GeneralizedInstrumental Variable Estimation)

    I and... the names of the models in the program are close to thenames you will see in Erik’s notes

    I Fairly easy to do Monte Carlo simulations demonstrating howe.g. heteroskedasticity, autocorrelation and endogneity affectsestimated coefficients when we use OLS

    I Finally, it is relatively easy to use and provides a lot of outputthat are essential to any econometric analysis!

    ECON 4160: Computer Class Department of Economics, University of Oslo

  • Introduction Econometric software menu Review of elementary econometrics using OxMetrics

    PcGive

    When you’re unsure about something (or just want to explore theoptions) in PcGive, go here:

    http://pcgive.com/pcgive/index.html

    Or use the help menu in the program (we’ll see later)

    ECON 4160: Computer Class Department of Economics, University of Oslo

    http://pcgive.com/pcgive/index.html

  • Introduction Econometric software menu Review of elementary econometrics using OxMetrics

    http://www.oxmetrics.net/

    ECON 4160: Computer Class Department of Economics, University of Oslo

    http://www.oxmetrics.net/

  • Introduction Econometric software menu Review of elementary econometrics using OxMetrics

    Topics for first computer class

    I Loading the data into the program and get to “know”the data(always start by looking at graphs!)

    I Variable transformationsI Note 1 to computer class: Use of the natural logarithm

    I Simple regression and mis-specification testingI Note 2 to Computer class: Standard mis-specification tests

    I Regression and mis-specification testing with the use of thebatch language

    I Stability of regression models

    I At last (if time) you will have the opportunity to use yournewly acquired skills to look at US housing price data from1890 to today!

    ECON 4160: Computer Class Department of Economics, University of Oslo

  • Introduction Econometric software menu Review of elementary econometrics using OxMetrics

    Regression with experimental and non-experimental data

    Consider the modelling task with experimental/lab data:

    Yiresult

    = g(Xi )input

    + vishock

    (1)

    and compare with the situation with non-experimental, real-worlddata:

    Yiobserved

    = f (Xi )explained

    + ε iremainder

    (2)

    ECON 4160: Computer Class Department of Economics, University of Oslo

  • Introduction Econometric software menu Review of elementary econometrics using OxMetrics

    Clearly, we know much less about the match between f (Xi ) and Yiin the non-experimental case: We simply can’t control the inputand then study the output. Often, we may not even know allvariables that are included in the vector Xi ! Thus, our choice offunctional form, f (·), and explanatory variables, Xi , will bereflected in the remainder ε i :

    ε i = Yi − f (Xi ) (3)

    However, we will follow custom and refer to ε i as the disturbanceand the estimated counterpart ε̂ i as the residual.

    ECON 4160: Computer Class Department of Economics, University of Oslo

  • Introduction Econometric software menu Review of elementary econometrics using OxMetrics

    I We will then need to keep in mind that the assumptions thatwe make about the disturbances , e.g., the “classicalassumptions” are only tentative, and that we need to test thatthey are valid after estimation

    I This is called residual mis-specification testing

    ECON 4160: Computer Class Department of Economics, University of Oslo

  • Introduction Econometric software menu Review of elementary econometrics using OxMetrics

    Residual mis-specification overview

    Disturbances ε i are:Xi heteroscedastic autocorrelated

    β̂1 V̂ar(β̂1) β̂1 V̂ar(β̂1)

    exogenousunbiased

    consistentwrong

    unbiased

    consistentwrong

    predeterminedunbiased

    consistentwrong

    biased

    inconsistentwrong

    ECON 4160: Computer Class Department of Economics, University of Oslo

  • Introduction Econometric software menu Review of elementary econometrics using OxMetrics

    Test battery in PcGive I: Non-normalityNormality, Jarque and Bera (1980): (Note: Small samplecorrection in Give)Test the joint hypothesis of no skewness and no excess kurtosis(3rd and 4th moment of the normal distr.):

    JB =n

    6

    (Skewness2 +

    1

    4Excess kurtosis2

    )(4)

    The sample skewness and excess kurtosis (skewness = 0 andkurtosis = 3 for normal distr. is defined as follows):

    Skewness =1n ∑

    ni=1 (ε̂ i − ¯̂ε)

    3(1n ∑

    ni=1 (ε̂ i − ¯̂ε)

    2) 3

    2

    =1n ∑

    ni=1 ε̂

    3i(

    1n ∑

    ni=1 ε̂

    2i

    ) 32

    (5)

    Excess kurtosis =1n ∑

    ni=1 (ε̂ i − ¯̂ε)

    4(1n ∑

    ni=1 (ε̂ i − ¯̂ε)

    2) 4

    2

    =1n ∑

    ni=1 ε̂

    4i(

    1n ∑

    ni=1 ε̂

    2i

    )2 (6)Null is normality.

    ECON 4160: Computer Class Department of Economics, University of Oslo

  • Introduction Econometric software menu Review of elementary econometrics using OxMetrics

    Test battery in PcGive II: HeteroskedasticityHeteroskedasticity, White (1980):Auxiliary regression:

    ε̂2i = β0 + β1Xi + β2X2i + ui (7)

    Test that β1 = β2 = 0 against non-zero using an F-test.Hetero X (two or more regressors), White (1980)Auxiliary regression:

    ε̂2i = β0 + β1Xi + β2Zi + β3XiZi + β4X2i + β5Z

    2i + ui (8)

    Test that β1 = β2 = β3 = β4 = β5 = 0 against non-zero using anF-test.In both cases the null is homoskedasticity.

    ECON 4160: Computer Class Department of Economics, University of Oslo

  • Introduction Econometric software menu Review of elementary econometrics using OxMetrics

    Test battery in PcGive III: Autocorrelation

    Autocorrelation, Godfrey (1978):Auxiliary regression (note, i is now time unit! Call it t):

    ε̂t = β0 +p

    ∑i=1

    βi ε̂t−i + βpXt + ut (9)

    A test for pth order autocorrelation is then to test thatβ1 = β2 = · · · = βp = 0 against non-zero using an F-test.Null is no autocorrelation.

    ECON 4160: Computer Class Department of Economics, University of Oslo

  • Introduction Econometric software menu Review of elementary econometrics using OxMetrics

    Test battery in PcGive IV: Autoregressive conditionalheteroskedasticity

    ARCH, Engle (1982):Auxiliary regression:

    ε̂t = β0 +p

    ∑i=1

    βi ε̂2t−i + ut (10)

    A test for pth order ARCH is then to test thatβ1 = β2 = · · · = βp = 0 against non-zero using an F-test.Null is no ARCH.

    ECON 4160: Computer Class Department of Economics, University of Oslo

  • Introduction Econometric software menu Review of elementary econometrics using OxMetrics

    Test battery in PcGive V: Regression Specification Test

    RESET, Ramsey (1969):Auxiliary regression (Note 2,3 in PcGive means squares andcubes!):

    ε̂t = β0 + β1Xt + β2Ŷt + β3Ŷ2t + ut (11)

    A test for pth order ARCH is then to test that β1 = β2 = 0against non-zero using an F-test.Null is no specification error.

    ECON 4160: Computer Class Department of Economics, University of Oslo

    IntroductionEconometric software menuReview of elementary econometrics using OxMetrics