Ox Metrics Intro

84
Introduction to OxMetrics 7 June 2010 J. James Reade

Transcript of Ox Metrics Intro

Page 1: Ox Metrics Intro

Introduction to OxMetrics

7 June 2010

J. James Reade

Page 2: Ox Metrics Intro

Outline

• Introduction to OxMetrics.

• Pre-modelling: Data management.

• Modelling: Using the packages.

• Post-modelling: Misspecification and further analyses.

• Purpose of slides:

– Cannot cover all material in slides!– Slides provide information to start using OxMetrics and PcGive.

[email protected] 2

Page 3: Ox Metrics Intro

Introduction: What is OxMetrics?

• Formerly GiveWin: Front-end for doing econometric analysis.

– Front-end: Menu driven, not code-based. Easier to use.∗ But: Front-ends constrain you to do what it thinks you want to do.

– But: Not restricted to menus: All underwritten by Ox Programming language.∗ Learning underlying code grants flexibility at a cost: Learning the language.

• OxMetrics acts as an umbrella for many packages:

– E.g. PcGive, G@RCH, PcNaive, . . .– Packages are for doing econometrics analysis:∗ Single/multiple-equation modelling.∗ Limited-dependent variable modelling.∗ GARCH modelling.∗ Panel data analysis.∗ Etc.

– Packages often written by others: Experts in their own fields.

[email protected] 3

Page 4: Ox Metrics Intro

OxMetrics vs Other Packages

• Historical development of econometric software fascinating.1

– Stata, Eviews, PcGive (now OxMetrics), RATS, Limdep, Microfit...

• Stata:

– Historical perception: Stata for non-time series, OxMetrics for time series.– Both now cross into each others’ territories extensively.∗ Time series still considerably easier in OxMetrics than Stata.

• Eviews:

– Traditionally more general than Stata but less popular.– OxMetrics faster, more accurate than Eviews, developed by leading minds:∗ David Hendry, Siem Jan Koopman, Steve Bond, Andrew Harvey...

• Renfro: “User inertia is an important aspect of the software experience.”

1See Renfro, C.G., “Econometric Software: The first Fifty Years in Perspective”, Journal of Economic and SocialMeasurement, 29 (2004).

[email protected] 4

Page 5: Ox Metrics Intro

OxMetrics: Context

• Contrary to belief, OxMetrics is used widely and not just in Oxford.

• More than other packages, OxMetrics reflects an econometric methodology.

– The Hendry, or LSE approach: General-to-specific.

• Advantage: Thorough and rigorous econometric methodology.

• Disadvantage: Not everyone’s cup of tea.

• Practically:

– Some tests unavailable (KPSS and other unit root/cointegration tests).– Automated General-to-specific algorithm built in:∗ Autometrics (previous incarnation PcGets).

– Little else different.

[email protected] 5

Page 6: Ox Metrics Intro

The Methodology Behind OxMetrics

• Various parts of Hendry (1995) express it probably best: General-to-specific.

• Model misspecification is the fundamental problem in econometrics:

– Manifests itself in unexpected ways, and many solutions out there are inappropriate.

• E.g.: Wrong signs on coefficients:

– Omitted variable bias and other biases caused by misspecification.– You are not modelling what you think you are modelling!

• But sometimes commercial pressures dictate:

– E.g.: HACSE, correlograms.

[email protected] 6

Page 7: Ox Metrics Intro

Doing Economics and Econometrics: The Way Forward

• Programming ability essential: Even for pure economic theory:

– Models complicated and programs like Matlab help solving.

• OxMetrics or Stata useful tools, but limited.

– Complicated and exotic likelihood models may not be included.

• Learn a programming language.

– Stata’s own code: .do and .ado files.– Ox: Underlies OxMetrics and its modules.∗ But has much wider range of modules/sub-routines itself.∗ Developed specifically with econometric needs in mind.

– Matlab, Mathematica, R, Gauss,. . .

[email protected] 7

Page 8: Ox Metrics Intro

Getting Started

• Open by locating OxMetrics on your system.

• Disambiguating:

– OxMetrics (in Economics Software?) is what you want, not OxEdit.2

– OxMetrics is the software package, or front-end. PcGive, G@RCH etc are moduleswithin.

• Getting OxMetrics on your computer:

– Licence on the way: All staff can have OxMetrics, as can students.

2OxEdit is a text editor developed specifically for Ox, but many people write and compile LATEX and other languages usingit.

[email protected] 8

Page 9: Ox Metrics Intro

Getting to grips with OxMetrics: Tasks

1. Open OxMetrics.

2. Go to File, New, and select: OxMetrics (Graphics: ∗.gwg)

3. Right click on the white area, select Draw and Draw a Freehand Line.

4. Sign your name.

5. Double click on plot area, select Regression/Scale.

• In Regression bit set number of lines to 1.• You have successfully regressed your signature.

[email protected] 9

Page 10: Ox Metrics Intro

The OxMetrics Interface

• Now have experience of Graphics in OxMetrics:

– Very powerful and flexibly tool for plotting data.– Vastly superior and more elegant than Excel, more flexible than Stata.3

• Graphics is a central part of the OxMetrics interface.

– Econometric analysis carried out using Modules.

• Pre-estimation mainly OxMetrics:

– Loading data.– Organising data:∗ Checking summary statistics.∗ Checking for ‘holes’ or other problems.∗ Data transformations and data creation.∗ Plotting data.

3I think!

[email protected] 10

Page 11: Ox Metrics Intro

Nice Features of OxMetrics Interface

• Can open many documents at once of different types: All in LHS toolbar.

– Can easily view data files unlike in Stata (and open many data files).

• Help very easy and convenient to find: Press F1 or go to Help menu.4

• Can do most things via icons on toolbar along top: More later. . .

• Text editing:

– Right clicking: Highlight by column.∗ Right click on that: Can sort and sum.

– Pasting from history: Can paste up to nine items: From Ctrl+1 to Ctrl+9.– Searching for next/previous incidence:

∗ Highlight word or set of characters you want to find and hit:

• Find in files: Very useful for finding files with certain text in them.5

4Admittedly this is more useful when Ox programming than using OxMetrics more generally. But manuals are online.5For non-Mac users, that is. . .

[email protected] 11

Page 12: Ox Metrics Intro

Loading Data

• First task: Opening data.

• OxMetrics has own datafile format:

– .in7 and .bn7.– But can load .xls and .csv files directly.6

– Can also copy and paste data.

• But: Must be careful about format of csv/xls file:

– Need date in first column (with no column title) in form 1957-1 or 1957-12-24.– Keep names simple, ensure no ‘holes’ in data.7

• Important for time series: PcGive treats sample as up to first .NaN entry.

6Can load most types of data file in OxMetrics, including Stata .dta files.7I.e. no variables without names. OxMetrics will generally change any blank data cells to .NaN but better to be on safe

side and do this yourself (or enter N/A in blank cells).

[email protected] 12

Page 13: Ox Metrics Intro

Data Management

• Assuming you have loaded your data file:

• What is there and what does it look like?

– OxMetrics has plenty of tools for analysing data pre-estimation.

• Summary Statistics:

– Right click and Data Description or View and Summary Statistics.8

Database: US_China_1m_IB.csv

Sample: 2002-01-01 Tue - 2010-01-06 Wed (2092 observations)

Variables: 5

Variable leading sample #obs #miss minimum mean maximum std.dev

Svar1 1 to 2092 2092 0 2.4523e+06 2.4537e+06 2.4552e+06 845.47

China 1 to 2079 2078 14 0 2.6621 9.9 0.95229

US 1 to 2079 2078 14 0.2325 2.6609 5.8238 1.7371

ExchangeRate 1 to 2092 2092 0 6.8109 7.8442 8.7129 0.62651

1MFWDExchangeRate 29 to 2092 2063 29 6.7834 7.7727 8.2841 0.57096

8Provided the active window within OxMetrics is the data file.

[email protected] 13

Page 14: Ox Metrics Intro

Pre-Estimation: Hocus-pocus?

• May come across those who claim looking at data pre-estimation wrong:

– Contaminates later findings.

• OxMetrics’ pre-estimation tools artefact of econometric methodology:

– You need to know what data looks like before you model it.– Helps determine correct model for data:∗ Stationarity, structural breaks, lag length, data transformations (e.g. logs). . .

[email protected] 14

Page 15: Ox Metrics Intro

Plotting data

• OxMetrics has great flexibility for plotting data.

• Huge range of possible types of plot. Easy to access.

• Multiple series on a set of axes, multiple sets of axes.

• Manipulation of axes and series much more intuitive than Excel.

• Copy and paste works in wonderful ways. . .

• Can save in eps format, ideal for including in LATEX documents.9

9PDF files are easy to create from eps: Type eps2pdf into Google and download the relevant program for your operatingsystem.

[email protected] 15

Page 16: Ox Metrics Intro

Plotting Data: An Example

Spot Exchange Rate 1−month Forward Exchange Rate

2002 2003 2004 2005 2006 2007 2008 2009 2010

7.00

7.25

7.50

7.75

8.00

8.25

8.50

8.75Spot Exchange Rate 1−month Forward Exchange Rate

2005 2006

8.1

8.2

2009 20106.8

6.9

7.0

[email protected] 16

Page 17: Ox Metrics Intro

Plotting Data

• Hit the Graphics button: .10

• Double click on series to plot.

• Click OK then select type of graph to plot.

10Or Model, Graphics, or Alt+G.

[email protected] 17

Page 18: Ox Metrics Intro

Plotting: Big Picture

• General intent is to present econometric results.

• Credibility enhanced if clear and intuitive plots of data provided.

– What plots will best help your story?– Will they just take up space?11

• Thus likely you will return to pre-estimation graphics later.

• Important to ensure plot labels and numbering visible and make sense.

11Double clicking on a plotted graph, selecting the Graph layout tab, and changing the Aspect ratio (Y scale)to Half height 50% will provide a graph half as high as it is wide, very useful for including in papers without taking uptoo much space.

[email protected] 18

Page 19: Ox Metrics Intro

Another Data Manipulation Tool: Aggregation

• Data may be of different frequency: Matching manually tedious.

– May also wish to estimate model over different frequencies: Robustness.– ARCH big problem at high frequency: Noice vs signal.

• With your dataset as active window, select Edit -> Aggregate.

• Resulting menu allows aggregation to many different frequencies.

– Weekly, 4-week periods, monthly, quarterly, bi-annually, annually.

• Also allows different aggregation methods:

– End-period, mid-period, average, sum, peak, trough.

• Incredibly flexible and useful tool.

[email protected] 19

Page 20: Ox Metrics Intro

Plotting Data: Tasks

1. Plot Actual series of all four variables. Give plot name of your choice.12

2. Try plotting data transformations, would a log scale help?

3. Investigate the kinds of plots possible — do they make sense?

• Correlation: Auto, Partial Auto, Cross.• Distributions and scatter plots.• 3D plots.

4. Manipulate your plots. How many axes do you want in each file? Lines or dots?

• Double click on your plot and explore the possibilities.13

5. Annotate your plot in helpful ways. Just start writing with cursor over plot.14

12Try the Rename option in the File menu if you don’t really want to save just yet.13For putting plots into papers, increasing font size and line thickness useful. Also saving an viewing modes in colour,

grayscale or black and white. Colour for slides, grayscale for papers.14Note that by using $ signs, you can include LATEX maths in your plots.

[email protected] 20

Page 21: Ox Metrics Intro

Post-Plotting and Summarising

• Data plots and summarising help in deciding appropriate model.

• May also reveal need for extra variables:

– Dummy variables for events in time or characteristics in cross-section.– Interaction terms and transformations of variables:∗ A quadratic term perhaps for effect of education?∗ Inflation instead of the price level (CPI)?∗ Debt as a percentage of GDP?

• Create and manipulate variables using Calculator:

[email protected] 21

Page 22: Ox Metrics Intro

The Calculator Tool

• Data transformations: Lags, logs, differences, percentage changes,. . .

• Creating variables: Dummies, quadratic trends, interaction terms,. . .

• Other...: Extensive list of data transformations.

[email protected] 22

Page 23: Ox Metrics Intro

Creating New Variables: Tasks

1. Create a variable for the daily change in the exchange rate.

2. Create a variable for the monthly change in the US interest rate.

3. Create a variable for log(1 + rt) and check how similar to rt it is.15

4. Create the log ratio of the forward and spot exchange rates.

5. Plot all the variables you create. Do they look as you expected?

6. In mid-June 2005 the forward rate drops sharply and the spot rate drops at the startof August 2005.

• Try to work out when the changes took place exactly and create dummy variables.16

15Note the need to convert the first six observations of the Chinese interest rate, which as NA entries cause issues whentaking logs. Right click on these observations and select Edit Value... and check the box for Missing Value.

16Hovering over the break in a plot will tell you roughly what date the shift took place. Then look at the data and workexactly when it happened.

[email protected] 23

Page 24: Ox Metrics Intro

Manipulating your Data: Batch Files

• Transforming data easy via calculator in PcGive. . .

– But if doing empirical work, need to document what you did. Integrity.– Good method: Write an algebra file.– Calculator simply generates algebra code — look at Results.

• Algebra file (.alg) is code to create variables:

Inflation = diff(CPI, 4)/lag(CPI, 4);

• Task: Create your own algebra file.

– Go to File and New... or hit Ctrl+N.

[email protected] 24

Page 25: Ox Metrics Intro

Post Data Manipulation

• Pre-estimation carried out in OxMetrics, the Front-End.

• Estimation carried out using Module: Select module via

• PcGive is the Module we will use, but PcGive has many possibilities.

– Select Models for time-series data and Single-equation DynamicModelling using PcGive.

[email protected] 25

Page 26: Ox Metrics Intro

Autometrics?

• Clicking OK leads to the next menu: Autometrics options.

– Autometrics is PcGive’s automatic model selection algorithm.– Based on Hendry (1995) Ch. 9, the General-to-specific modelling methodology.∗ Start with most general model possible: All variables that might be relevant.∗ Omit variables if t- and F-tests permit, and also if misspecification tests allow.∗ Find most parsimonious/simple model possible satisfying misspecification tests.

– Takes specified model as the general unrestricted model (GUM).∗ Massively useful modelling tool. But leave for now.

[email protected] 26

Page 27: Ox Metrics Intro

Modelling Using PcGive

• Having selected type of modelling using PcGive, must specify regression model.

• Variables in dataset on RHS, double clicking will select them.17

– Constant will be automatically included. Double click it if you don’t want it.18

17As will highlighting them and hitting the double arrow buttons.18Double clicking in the Selection window de-selects a variable.

[email protected] 27

Page 28: Ox Metrics Intro

Modelling Using PcGive

• Check variable status is appropriate:

– Automatically first variable is dependent variable: Denoted Y for endogenous.– Rest are given default Regressor status (but not marked with Z).– Change status using Use default status drop-down menu and hitting set.– Multiple endogenous variables possible: Must instrument extra Ys.∗ Change status to A: instrument/fixed and hit set.

• Bottom right: Can select which dataset to choose variables from.

– Handy when more than one dataset open.– But cannot select variables from different datasets for a model.

• Bottom left: Recall a previous model:

– Lists all previous models estimated using PcGive.– Can reselect previous model if need to.

[email protected] 28

Page 29: Ox Metrics Intro

Our Model

• Interested in Covered Interest Parity between US and China:

iUS,t = (ft − st) + iCh,t. (1)

• Hence dependent variable (Y) is US interest rate (recall log approximation).

• Explanatory variables: Log forward, spot exchange rates, Chinese interest rate.

• Estimation methodology: General-to-specific.

– So estimate first unrestricted version and then test model restrictions.

iUS,t = β0 + β1ft + β2st + β3iCh,t + εt, εt ∼ iidN(0, σ2

). (2)

– Test β0 = 0, β2 = −1, β1 = β3 = 1 and that εt iid Normal.19

19Absence of Normality (autocorrelation, heteroskedasticity) implies important explanatory power left out of model.

[email protected] 29

Page 30: Ox Metrics Intro

Cross Section Modelling Using PcGive

• Can choose to estimate over full sample or some subset.

– In time series sometimes we only care about particular time period.

• Estimation method in Cross Section is only OLS.

– IV possible: Need to specify extra endogenous variable when selecting variables.– Reflects methodology behind PcGive again: Other methods non-robust.20

• Can also select type of standard errors (robust or not).

20E.g. Least Absolute Deviations.

[email protected] 30

Page 31: Ox Metrics Intro

Post-Estimation: Interpreting Model Output

• Clicking OK should yield the model output:

EQ( 7) Modelling US by OLS-CS

The dataset is: /Users/jamesreade/Documents/Data/Mon Ind/US_China_1m_IB_jr.csv

The estimation sample is: 2002-02-08 - 2009-12-17

Coefficient Std.Error t-value t-prob Part.Rˆ2

Constant -3.56565 1.038 -3.44 0.0006 0.0057

China 0.597886 0.03835 15.6 0.0000 0.1062

LExchangeRate -8.44612 2.599 -3.25 0.0012 0.0051

L1MFWDExchangeRate 10.7424 2.801 3.84 0.0001 0.0071

sigma 1.64242 RSS 5519.1801

Rˆ2 0.116922 F(3,2046) = 90.3 [0.000]**Adj.Rˆ2 0.115628 log-likelihood -3923.97

no. of observations 2050 no. of parameters 4

mean(US) 2.67242 se(US) 1.74649

• Important but not yet appropriate to scrutinise in detail:

– Not checked if residuals are Normally distributed: Is model well specified?

[email protected] 31

Page 32: Ox Metrics Intro

Automatic Graphical Model Output

• Check the Graphics part of Documents bar (LHS) for Model.

US Fitted

2002 2003 2004 2005 2006 2007 2008 2009 2010

2

4

6

US Fitted

r:US (scaled)

2002 2003 2004 2005 2006 2007 2008 2009 2010

−1

0

1

r:US (scaled)

[email protected] 32

Page 33: Ox Metrics Intro

Post-Estimation: Misspecification Testing Output

• To carry out post-estimation testing hit Test button:21

• Resulting menu gives post-estimation options we will explore.

• For now, select Test Summary:

Normality test: Chiˆ2(2) = 637.54 [0.0000]**Hetero test: F(6,2043) = 384.85 [0.0000]**Hetero-X test: F(9,2040) = 394.87 [0.0000]**RESET23 test: F(2,2044) = 104.14 [0.0000]**

• Output: Type of test, test statistic distribution, test statistic, p-value, significance.

– Standard: ∗ is rejection at 5% level, ∗∗ rejection at 1% level.

21Or Model and Test, or Alt+T.

[email protected] 33

Page 34: Ox Metrics Intro

What are these tests?

• Normality: Test for skewness and excess kurtosis.

– Both should be zero if distribution Normal.– Sample variants have Chi-square distribution hence can make test.– Combine two stats for Normality test statistic.– Test reported is Doornik-Hansen variant: Small-sample correction.

• Heteroskedasticity: White test:

– Regress squared residuals on regressors and squared regressors.– X test also includes cross-products.– Significance of any regressors of combinations of ⇒ heteroskedasticity.

• RESET test: Test of functional form:

– Include squares and cubes of fitted values in original regression model.– Significance of squares and cubes implies wrong functional form assumed.

[email protected] 34

Page 35: Ox Metrics Intro

More Detail: Test in the Test Menu

• To help diagnose a problem, may be helpful to get more details.

• Choose Test... in the Test menu:

– Further menu containing summarised tests.

• Heteroskedasticity tests will provide coefficients:

– Can possibly identify source of heteroskedasticity.22

• Normality test contains details on skewness and excess kurtosis:

– Skewness more harmful than excess kurtosis.

• RESET tests provide coefficient estimates also.

– Index test removes variables that are identical after squaring/cubing.22However, more likely omitted variables or structural form problems cause heteroskedasticity rather than anything in model.

[email protected] 35

Page 36: Ox Metrics Intro

Post-Estimation: Misspecification Graphical Output

• Model looks very badly specified. Testing only gives so much information.

• Graphical analysis can sometimes be illuminating:

– E.g. What does residual distribution look like?

• Check Graphical Analysis... from Test Menu.

• Options:

– Actual and fitted values: Plots both — how well does model fit data?– Cross plot of actual and fitted: Scatter plot — high correlation = good model.23

– Residuals (scaled): Plot of all residuals, scaled by standard deviation.24

– Residual density and histogram: Distribution of residuals: Is it Normal/symmetric?

23Since fitted similar to actual.24Hence if Normally distributed and model has constant, scaled versions are standard Normally distributed.

[email protected] 36

Page 37: Ox Metrics Intro

Post-Estimation: Graphical Output

US Fitted

2002 2003 2004 2005 2006 2007 2008 2009

2

4

6US Fitted US × Fitted

2.5 3.0 3.5 4.0

2

4

6US × Fitted

r:US (scaled)

2002 2003 2004 2005 2006 2007 2008 2009

−2

−1

0

1

r:US (scaled) r:US N(0,1)

−3 −2 −1 0 1 2

0.25

0.50

0.75

1.00

Densityr:US N(0,1)

[email protected] 37

Page 38: Ox Metrics Intro

Post-Estimation: Predictions

• Two reasons for modelling:

1. To understand an economic phenomenon better.– How have China and the US interacted financially?

2. To predict something.– How will they interact financially?

• PcGive allows forecasting or prediction.

– Forecasting a time-series concept, prediction more cross-section.∗ But in C-S, need observations on explanatory variables to predict.

• We’ll return to Prediction in its more natural context: Time series modelling.

[email protected] 38

Page 39: Ox Metrics Intro

Post-Estimation: Further Output

• More information available for diagnosing problems or supporting results.

– Correlations between regressors, robust standard errors, information criteria.– Printing of residuals can be useful: Which ones are big? Outliers?

• Writing model results:

– Equation format: Written intuitively in text form.– LATEX format: For copying and pasting into your tex document.– Non-linear model format: Batch code for non-linear modelling.

[email protected] 39

Page 40: Ox Metrics Intro

Post-Estimation: Interpreting Model Output

• Now checked for misspecification, can start to consider results. . .

– . . . if model well specified!– Ours isn’t but we’ll look anyway. . .

EQ( 9) Modelling US by OLS-CS

The dataset is: /Users/jamesreade/Documents/Data/Mon Ind/US_China_1m_IB.csv

The estimation sample is: 2002-02-08 - 2009-12-17

Coefficient Std.Error t-value t-prob Part.Rˆ2

Constant -3.56565 1.038 -3.44 0.0006 0.0057

China 0.597886 0.03835 15.6 0.0000 0.1062

LExchangeRate -8.44612 2.599 -3.25 0.0012 0.0051

L1MFWDExchangeRate 10.7424 2.801 3.84 0.0001 0.0071

sigma 1.64242 RSS 5519.1801

Rˆ2 0.116922 F(3,2046) = 90.3 [0.000]**Adj.Rˆ2 0.115628 log-likelihood -3923.97

no. of observations 2050 no. of parameters 4

mean(US) 2.67242 se(US) 1.74649

• se standard error, Part.Rˆ2 partial R2, Adj.Rˆ2 is R2.

[email protected] 40

Page 41: Ox Metrics Intro

Post-Estimation: Testing Economic Theory Hypotheses

• We want to test whether Covered Interest Parity is upheld in our model.

• Test Menu: Select Linear Restrictions or General Restrictions.

• Linear Restrictions:

– Recall: Rβ = r where R is restrictions, β coefficients and r sum of restrictions.– E.g. R = (1, 0, 0, 0), β = (β0, β1, β2, β3)′, r = 0.– Tests constant β0 equal to zero.– Each column of R a restriction. Need 4.

Test for linear restrictions (Rb=r):

R matrix

Constant ChinaLExchangeRateL1MFWDExchangeRate

1.0000 0.0000 0.0000 0.0000

0.0000 1.0000 0.0000 0.0000

0.0000 0.0000 1.0000 0.0000

0.0000 0.0000 0.0000 1.0000

r vector

0.0000 1.0000 -1.0000 1.0000

LinRes F(4,2046) = 32.670 [0.0000]**

[email protected] 41

Page 42: Ox Metrics Intro

General Restrictions

• Linear restrictions requires you to recall econometrics.

• General restrictions requires to you write some code:

– Each variable denoted by ampersand (&) and number:∗ Key beneath.

– RHS of code line must be zero.– Each restriction is line of code; must be ended with semi-colon ;.– Code gives flexibility: Could write &2+&3=0.

Test for general restrictions:

&0=0;

&1-1=0;

&2+1=0;

&3-1=0;

GenRes Chiˆ2(4) = 130.68 [0.0000]**

• Different test statistics; same test result. Heavy rejection of theory.

[email protected] 42

Page 43: Ox Metrics Intro

Batch File

• As before, want to document what you do: Especially useful if you take break!

• Estimate model then hit batch button.

– Produces new window with Batch code in.– Better to hit Save Save As... than work in window.

• Tasks:

1. Estimate your model and create Batch file.2. Change sample size and re-estimate.

[email protected] 43

Page 44: Ox Metrics Intro

Ox Batch Code

• New to recent versions of OxMetrics: Can generate Ox code.

– Ox is programming language OxMetrics written in.

• Model and Ox Batch Code..., or Alt+O opens Ox file.

– File contains Ox code used by OxMetrics to generate output you found.

• Taking a look, and amending code highly recommended:

– Programming languages are the future.

[email protected] 44

Page 45: Ox Metrics Intro

Post-Estimation: Many Other Options

• The Test Menu has many possibilities for post-estimation activity.

• Test... contains more detailed versions of summary tests.

– E.g. Normality test gives χ2 stat for skewness and kurtosis: Numbers alwaysuseful when writing up results.

• Testing for omitted variables (no different to including them though).

• Test exclusion restrictions: More than one variable and not all of them.25

• Store Residuals etc. in Database:

– Very useful feature: Can append dataset with residuals εt and fitted values rUS,t.– Can manually run tests on residuals/fitted values and create various plots.

25Test for all variables is given in model output. You can check this. . .

[email protected] 45

Page 46: Ox Metrics Intro

Improving on the Model

• Important part of econometric modelling: Taking stock and improving.

– Hendry: Progressive modelling strategy.– Although: Should start as general as possible. . .

• OxMetrics allows tracking of model development: Hit Progress... on Module.

– Checking a number of models produces comparative statics between models:∗ Log-likelihoods, sample sizes, number of parameters, information criteria.

– Can also Recall a previous model from Formulate window:∗ Useful if want to re-estimate a model.

• More fundamental potential improvement: Adopt different model specification:

– OxMetrics houses many Modules for different model types. . .

[email protected] 46

Page 47: Ox Metrics Intro

Modelling Time Series Data

• This term with Bent Nielsen you will cover time-series econometrics:

– Neil and Steve should have provided you with brief intro.– Essence: Data through time usually displays persistence.– Model persistence by including lags of dependent (and independent) variables.

• PcGive has huge capacity for dealing with time series.

– Pre-estimation: Graphing, data manipulation (e.g. aggregation).– Estimation: PcGive developed as a time-series package.∗ Adding lags, differences, coping with non-standard distributions.· Calculating long-run solutions and error-correction terms.

∗ VAR modelling, Johansen cointegration procedures.26

– Post-estimation:∗ Recursive analysis, Impulse response analysis.

26In multi-variate modelling.

[email protected] 47

Page 48: Ox Metrics Intro

Getting Going With Time Series

• Graphing: Time-series properties helps model choices:

– Autocorrelation function (ACF): Gently declining implies autoregressive series.– Partial ACF (PACF): Helps to determine lag length.27

– Cross-correlation function (CCF): Correlation between series and lags of another.– Spectral density plots.– Seasonal sub-plots: Plots for each season to help detect patterns.

• Modelling: Models for time-series data, Single-equation DynamicModelling using PcGive.

27Choose as many lags as there are significant PACF lags.

[email protected] 48

Page 49: Ox Metrics Intro

Improving Our Model

rCh ,t

2002 2004 2006 2008 2010

2.5

7.5rCh ,t rUS ,t

2002 2004 2006 2008 2010

2.5

5.0 rUS ,t

st

2002 2004 2006 2008 2010

2.0

2.2

st ft

2002 2004 2006 2008 2010

2.0

2.1

ft

• Cursory glance at data series above tells us they display persistence.

• We model such time persistence using lagged dependent variables:

– Recall AR(K) model for home interest rate:

rUS,t = α0 + α1rUS,t−1 + · · ·+ αKrUS,t−K + νt, νt ∼ N(0, σ2

ν

). (3)

• α1 will likely be highly significant for all series in our model.

[email protected] 49

Page 50: Ox Metrics Intro

Modelling Time Series Data: Non-Stationarity

• Big problem with time series is non-stationarity:

– If time series non-stationary (unit-root processes), regressions may be spurious.

• Hence for our interest rates and exchange rates:

– Check for time dependence.– Test for non-stationarity.– Amend model accordingly (and make use of Autometrics).

[email protected] 50

Page 51: Ox Metrics Intro

Time Dependence

• It is standard to report the time-series properties of data being modelled.

– Unit root tests and ideally plots of data series also.28

– Also important: Affects distributions of test statistics.– Tomorrow: Can investigate effects using PcNaive in OxMetrics.

• PcGive allows unit-root testing. Generic time series xt:

xt = α0 + α1xt−1 + αKxt−K + et, et ∼ N(0, σ2

r

). (4)

• Unit root test is hypothesis that α1 = 1.

• Unit root test output tells us what α1 coefficient is, if not unity.

• But test dependent on correct lag specification:

– Too short: Omitted variable bias. Too long less important.

28Unit-root tests are usually criticised for a lack of power and hence other information is vital for characterising data series.

[email protected] 51

Page 52: Ox Metrics Intro

Choosing Lag Length

• Choose via PACF: Number of significant lags.

• Investigate via Information Criteria.

• Use Autometrics: Start with large number of lags and reduce.

• Can also use unit root test:

– Test output provides information.

• In Model: Other Models, Descriptive Statistics using PcGive.

[email protected] 52

Page 53: Ox Metrics Intro

Unit-Root Testing

• In resulting menu, choose variables of interest (can test many variables), click OK.

– In next menu, check the Unit-root tests box at the top.– Then access the drop down menu for Unit-root test settings if desired.29

• Rearrange AR(1) model to:

∆xt = α0 + φxt−1 +K−1∑k=1

γk∆xt−k + et. (5)

• Either:

– Test φ = 0 using standard t-test (but not t-distribution).– Test φ = 0 and α0 = 0 using standard F-test (but not F-distribution).

• Strategy: Start general and reduce if trend/constant insignificant.29Have a play around with the different options; most important is inclusion of constant and/or trend.

[email protected] 53

Page 54: Ox Metrics Intro

Unit-Root Test Output

• Appropriate Dickey-Fuller distribution critical values above each variable.

– D-lag: Number of lags of first differences∑K−1k=1 γk∆xt−k so K − 1.

– t-adf: t-test statistic for φ, stars based on DF distribution. beta Y 1: φ.– sigma: σ =

∑Tt=1 e

2t/T − (K + 1).

– t-DY lag: t-statistic of longest lagged difference coefficient: γK−1.

• Table for each variable: Can get more lags, and more detail (non-summary table).

Unit-root tests

The dataset is: /Users/jamesreade/Documents/Data/Mon Ind/US_China_1m_IB_jr.csv

The sample is: 2002-02-13 - 2009-12-17

China: ADF tests (T=2047, Constant; 5%=-2.86 1%=-3.44)

D-lag t-adf beta Y_1 sigma t-DY_lag t-prob AIC F-prob

2 -7.591** 0.92512 0.4052 -2.613 0.0090 -1.805

1 -8.167** 0.92058 0.4058 -10.35 0.0000 -1.802 0.0090

0 -10.50** 0.89793 0.4162 -1.752 0.0000

US: ADF tests (T=2047, Constant; 5%=-2.86 1%=-3.44)

D-lag t-adf beta Y_1 sigma t-DY_lag t-prob AIC F-prob

2 -0.4669 0.99982 0.03064 5.537 0.0000 -6.969

1 -0.2998 0.99988 0.03086 27.16 0.0000 -6.955 0.0000

0 0.4596 1.0002 0.03599 -6.648 0.0000

[email protected] 54

Page 55: Ox Metrics Intro

Time Series Modelling Using PcGive

• Time-series modelling provides more options than cross-section.

• When selecting variables, extra option for number of lags.

– Useful but can also be annoying.– Can have None, specific lag length Lag or all lags up to that length.

• Also got option for adding time trend automatically to model.

• Type of variables begins to get important now.

– Change type by either:∗ Right clicking on variable and selecting from menu.∗ Highlighting (click once) in Selection window, selecting desired status in Usedefault status menu and hitting Set.30

30Last step can easily be forgotten and wrong choices made.

[email protected] 55

Page 56: Ox Metrics Intro

Time Series Modelling Using PcGive

• Additional options for estimation:

– Usual OLS (equivalent to MLE if errors normal).– Instrumental variables:∗ Standard IV estimation: Specify instruments back at Variable Selection stage.∗ Must specify additional variable as Engogenous.31

∗ Estimation method: Only 2SLS.– Autoregressive least squares:∗ Iterative method of estimating an autoregressive error structure.∗ E.g. xt = α1xt−1 + ut, where ut = βut−1 + et.∗ Generally advisable to model autocorrelation in residuals.

• Autometrics options:

– Available for OLS and IV but not Autoregressive Least Squares.– Caution: By default next model at Formulate window is specific model.

31Second endogenous regressor treated as variable to be instrumented.

[email protected] 56

Page 57: Ox Metrics Intro

Post-Estimation: What Does Time Series Add?

• Test for residual autocorrelation and ARCH:32

– Part of Test Summary, can also go more detailed.

• Forecasting:

– Can construct and assess different types of forecast easily.

• Recursive analysis:

– Extensive range of recursive statistics and graphics.

32ARCH: Autoregressive Conditional Heteroskedasticity for the uninitiated.

[email protected] 57

Page 58: Ox Metrics Intro

Interpreting Model Output

• Nothing altered from cross-section output:

EQ(27) Modelling US by OLS

The dataset is: /Users/jamesreade/Documents/Data/Mon Ind/US_China_1m_IB_jr.csv

The estimation sample is: 2002-02-12 - 2009-12-17

Coefficient Std.Error t-value t-prob Part.Rˆ2

Constant -3.56730 1.038 -3.44 0.0006 0.0057

China 0.600000 0.03839 15.6 0.0000 0.1067

LExchangeRate -8.15856 2.609 -3.13 0.0018 0.0048

L1MFWDExchangeRate 10.4526 2.811 3.72 0.0002 0.0067

sigma 1.64258 RSS 5514.85552

Rˆ2 0.117418 F(3,2044) = 90.64 [0.000]**Adj.Rˆ2 0.116122 log-likelihood -3920.34

no. of observations 2048 no. of parameters 4

mean(US) 2.67324 se(US) 1.74715

[email protected] 58

Page 59: Ox Metrics Intro

The Test Summary

• Test summary includes residual autocorrelation and ARCH:

AR 1-2 test: F(2,2042) = 45492. [0.0000]**ARCH 1-1 test: F(1,2046) = 19589. [0.0000]**Normality test: Chiˆ2(2) = 637.64 [0.0000]**Hetero test: F(6,2041) = 383.77 [0.0000]**Hetero-X test: F(9,2038) = 393.44 [0.0000]**RESET23 test: F(2,2042) = 103.37 [0.0000]**

• Model terrible. Should add lagged dependent variable at minimum.

– Spurious significance possible: Already established unit-root behaviour.

• Autoregressive Distributed Lag (ADL) model:

– Distributed lag of explanatory variables.– Effect of variable spread over number of time periods.

[email protected] 59

Page 60: Ox Metrics Intro

Autoregressive Distributed Lag Model

• Consider xt with one lag and add yt to model:

xt = δ + α1xt−1 + β0yt + β1yt−1 + εt. (6)

• Model easy to estimate in PcGive: But is it appropriate/sufficient?

• Mechanics: AR(1) model only estimable over T − 1 observations.

– PcGive deducts observation automatically in Selection Sample if add lag.– Care when removing lags: Need to add back in observations (if want them).

• PcGive not restricted to set time series models:

– But some post-estimation time-series functionality is.

[email protected] 60

Page 61: Ox Metrics Intro

ADL for Covered Interest Parity

• Add contemporaneous level and lag of other variables:

iUS,t = δ + α1iUS,t−1 + β0iCh,t + β1iCh,t−1 + γ0ft + γ1ft−1 + θ0st + θ1st−1 + εt.

• Remember to check recursive estimation and save some observations for forecasting.

[email protected] 61

Page 62: Ox Metrics Intro

The ADL Model OutputEQ(28) Modelling US by OLS

The dataset is: /Users/jamesreade/Documents/Data/Mon Ind/US_China_1m_IB_jr.csv

The estimation sample is: 2002-02-12 - 2009-12-03

Coefficient Std.Error t-value t-prob Part.Rˆ2

US_1 1.00048 0.0004840 2067. 0.0000 0.9995

Constant -0.117155 0.02279 -5.14 0.0000 0.0128

China 0.000177891 0.001901 0.0936 0.9254 0.0000

China_1 -0.00203798 0.001899 -1.07 0.2834 0.0006

LExchangeRate 0.815535 0.5628 1.45 0.1475 0.0010

LExchangeRate_1 -0.882411 0.5607 -1.57 0.1157 0.0012

L1MFWDExchangeRate 2.88309 0.7046 4.09 0.0000 0.0082

L1MFWDExchangeRate_1 -2.75721 0.7064 -3.90 0.0001 0.0074

sigma 0.035644 RSS 2.57911023

Rˆ2 0.999583 F(7,2030) = 6.956e+05 [0.000]**Adj.Rˆ2 0.999582 log-likelihood 3907.26

no. of observations 2038 no. of parameters 8

mean(US) 2.68521 se(US) 1.74303

1-step (ex post) forecast analysis 2009-12-04 - 2009-12-17

Parameter constancy forecast tests:

Forecast Chiˆ2(10) = 0.34950 [1.0000]

Chow F(10,2030)= 0.033968 [1.0000]

CUSUM t(9) = 0.5808 [0.5756] (zero forecast innovation mean)

• Additional forecast analysis provided as standard.

[email protected] 62

Page 63: Ox Metrics Intro

Post-Estimation: Test Summary

AR 1-2 test: F(2,2038) = 353.63 [0.0000]**ARCH 1-1 test: F(1,2046) = 98.824 [0.0000]**Normality test: Chiˆ2(2) = 14958. [0.0000]**Hetero test: F(14,2033)= 15.293 [0.0000]**Hetero-X test: F(35,2012)= 8.3928 [0.0000]**RESET23 test: F(2,2038) = 5.4855 [0.0042]**

• Better but still not good.

• Tasks:

– Use Test... in Test menu to investigate test failures.– Use Post-estimation graphics to investigate:∗ Autocorrelation.∗ Normality.∗ Heteroskedasticity.

– How might you reformulate model?

[email protected] 63

Page 64: Ox Metrics Intro

Post-Estimation: The Long-Run Solution

• From your undergraduate degree recall we can rearrange ADL model:33

∆iUS,t = β0∆iCh,t + γ0∆ft + θ0∆st

+ φ [iUS,t−1 − κ0 − κ1iCh,t−1 − κ2ft−1 − κ3st] + εt.

• This is the equilibrium-, or error-correction form of our model:

– Contains long-run solution: iUS,t−1 − κ0 − κ1iCh,t−1 − κ2ft−1 − κ3st.– Where φ = (α1 − 1), κ0 = δ/(1− α1), κ1 = (β0 + β1)/(1− α1),. . .

• Variables non-stationary, but CIP relationship exists: Expect cointegration.

– Linear combination of I(1) variables that is I(0).– CIP is stationary, steady-state relationship amongst I(1) variables?– We can test this. . .

33See PcGive Vol. 1, Ch. 12.

[email protected] 64

Page 65: Ox Metrics Intro

Post-Estimation: Dynamic Analysis

• Select Dynamic Analysis... in the Test Menu.34

• Static long-run solution:

– Yields: iUS,t−1 − κ0 − κ1iCh,t−1 − κ2ft−1 − κ3st.– Requires model be of ADL form.– Provides standard errors of ECM terms, and Wald test of joint significance.

Solved static long-run equation for US

Coefficient Std.Error t-value t-prob

Constant 251.079 271.0 0.927 0.3543

China 4.08618 4.072 1.00 0.3158

LExchangeRate 145.122 202.4 0.717 0.4734

L1MFWDExchangeRate -271.774 324.0 -0.839 0.4017

Long-run sigma = 77.2275

ECM = US - 251.079 - 4.08618*China - 145.122*LExchangeRate + 271.774*L1MFWDExchangeRate;

WALD test: Chiˆ2(3) = 1.01629 [0.7973]

• Does not test for cointegration however. . .34See PcGive Vol. 1, Sec. 18.3, especially for graphing lag weights.

[email protected] 65

Page 66: Ox Metrics Intro

Cointegration Testing

• Cointegration testing makes use of other useful features of OxMetrics.

• Cointegration theory: xt ∼ I(1), yt ∼ I(1) but linear combination yt − βxt ∼ I(0).

• Hence regress yt on xt and save residuals since εt = yt − βxt in regression.

– Carry out unit root testing on residuals εt.– If residuals stationary, implies xy and yt cointegrated.35

• Tasks:

1. Regress iUS,t on iCh,t, ft and st.2. Save the residuals from the regression.3. Carry out unit root testing on the residuals.

35Subject to the caveat that Dickey-Fuller unit root tests are known to have low power hence conclude in favour of null(unit root) too often. Most cointegration is now done using VAR models: Come back tomorrow for that.

[email protected] 66

Page 67: Ox Metrics Intro

Post-Estimation: Dynamic Analysis

• Lag structure analysis:

Analysis of lag structure, coefficients:

Lag 0 Lag 1 Sum SE(Sum)

US -1 1 0.00046 0.000482

Constant -0.116 0 -0.116 0.0226

China 0.000167 -0.00205 -0.00188 0.000907

LExchangeRate 0.817 -0.884 -0.0668 0.0568

L1MFWDExchangeRate 2.88 -2.76 0.125 0.0612

Tests on the significance of each variable

Variable F-test Value [ Prob] Unit-root t-test

US F(1,2040) =4.3141e+06 [0.0000]** 0.95593

Constant F(1,2040) = 26.205 [0.0000]**China F(2,2040) = 2.3366 [0.0969] -2.0751

LExchangeRate F(2,2040) = 1.9184 [0.1471] -1.1774

L1MFWDExchangeRate F(2,2040) = 10.391 [0.0000]** 2.0442

Tests on the significance of each lag

Lag 1 F(4,2040) =1.0898e+06 [0.0000]**

• Unit-root tests based on (α1 − 1), (β0 + β1), etc.

[email protected] 67

Page 68: Ox Metrics Intro

Post-Estimation: Dynamic Analysis

• Roots of lag polynomials:

– Lag operator L s.t. Lxt = xt−1. AR(1): xt = αxt−1 + et ⇒ (1− αL)xt = et.– (1− αL) = a(L) is lag polynomial, here root is α−1. α < 1 for stability.

Roots of US lag polynomial:

real imag modulus

1.0005 0.0000 1.0005

Roots of China lag polynomial:

real imag modulus

12.250 0.0000 12.250

Roots of LExchangeRate lag polynomial:

real imag modulus

1.0818 0.0000 1.0818

Roots of L1MFWDExchangeRate lag polynomial:

real imag modulus

0.95661 0.0000 0.95661

• Roots of other variables for model reduction purposes:

– ADL for xt, yt: (1− α1L)xt = δβ0(1 + β1/β0)yt + εt.– If α1 = −β1/β0, divide thru by (1− α1L) for: yt = δ + β0xt + ut.– ut = εt/(1− α1L) ⇒ ut = α1ut−1 + εt, hence autoregressive errors.

[email protected] 68

Page 69: Ox Metrics Intro

Post-Estimation: Common Factors

• Test for common factors:

– Can formally test whether lag polynomials equal: α1 = −β1/β0.– Idea: Autocorrelated residuals often assumed in econometric modelling.– Common factors: Residual autocorrelation indicative of richer structure of model.∗ But not necessarily: AR test failure 6⇒ common factors.

COMFAC Wald test table, COMFAC F(3,2040) = 3.84376 [0.0093] **Order Cumulative tests Incremental tests

1 Chiˆ2(3) = 11.531 [0.0092]** Chiˆ2(3) = 11.531 [0.0092]**

[email protected] 69

Page 70: Ox Metrics Intro

Post-Estimation: Graphics

• As in Cross-Section, Graphics may help determine problems.

• Many additions in time series: Residual density options, ACFs and PACFs:

– May want to ‘trick’ PcGive into thinking your cross section is time series.

• Graphic possibilities:

– Actual/fitted values: Does model do well?– Residuals: Scaled, unscaled, pickled, roasted,. . . 36

• Residual density/actual plots:

– Distribution looks normal/iid? Skewed?– Heteroskedastic?

• Use these graphics to shape model re-specifications.

36See Further graphs

[email protected] 70

Page 71: Ox Metrics Intro

Post-Estimation: Graphics

US Fitted

2002 2004 2006 2008 2010

2

4

6US Fitted r:US (scaled)

2002 2004 2006 2008 2010

−10

0

10r:US (scaled)

r:US N(0,1)

−10 −5 0 5 10 15

0.5

1.0

1.5

2.0Density

r:US N(0,1) ACF−r:US PACF−r:US

0 5 10

−0.5

0.0

0.5

1.0ACF−r:US PACF−r:US

[email protected] 71

Page 72: Ox Metrics Intro

Thoughts Based on Graphics

• Appears to be some under/overshooting effect as US rate rises.

• Much greater volatility since financial crisis.

• Deterministic terms (dummy variables) to cope with difficulties?

• Or extra variables?

– E.g. VIX index, daily volatility of Dow Jones?

• Tasks:

– Consider reformulating model using Datastream.37

– Consider modelling over weekly, monthly or quarterly frequency. Does it make adifference?

37Assuming your computers have it!

[email protected] 72

Page 73: Ox Metrics Intro

Post-Estimation: Forecasts

• To forecast, must re-estimate and estimate over reduced sample size.

– At sample size selection (Estimate) menu, Change Less forecasts to 10.– Shortens estimation sample by 10 most recent observations.

• Can then forecast over these 10 observations.

• Evaluating model via forecast performance very common.

– But may not be indicative of model quality, esp. if data non-stationary.– Hendry (1995): Forecast performance of naive simple devices hard to beat.

• Post-estimation, go to the Test menu and select Forecast...

[email protected] 73

Page 74: Ox Metrics Intro

Two Types of Forecasting

• Denote forecast of variable xt at T + h made at T as xT+h|T

• Dynamic or h-step (static) forecasts?

– Assume model: xt = βxt−1 + εt.– h-step forecast is xT+h = βxT .∗ Forecasts further ahead (e.g. T + h+ 1) require knowledge of xT+1.

– Dynamic forecast is: xT+h = βxT+h−1, where xT+h−1 = βxT+h−2 and so on.∗ Each forecast is fed back in: May lead to cumulation of errors.

[email protected] 74

Page 75: Ox Metrics Intro

Forecasting: Tasks

• Select a different length of Forecasts to hold back.

• Evaluate the forecast performance of the model by both types of forecast.

• What is the forecast performance as h is increased?

• Compare the forecast performance of your model against a random walk model.

– Recall random walk model is xt = xt−1 + εt, or ∆xt = εt.– Remember you can copy and paste particular sets of plots in OxMetrics.

[email protected] 75

Page 76: Ox Metrics Intro

Recursive Estimation

• Recursive estimation is a method of model evaluation:

– Are coefficient estimates stable over the entire sample?– Or are they averages over structural breaks?

• Generally expected in any regression analysis submitted to a journal.

• Estimate over observations 1, 2, . . . , TI, where TI < T is the Initialisation.

– Evaluate all model parameters: β, σ, etc.

• Estimate over observations 1, 2, . . . , TI, TI + 1 and evaluate parameters.

– Keep going until reach full sample.

• Analysis:

– Plot parameters for different sample lengths.– Calculate test statistics to detect structural change.

[email protected] 76

Page 77: Ox Metrics Intro

The Doing of Recursive Analysis

• Must select recursive estimation at Estimate window.

• Need to also select Initialization: What is TI?

– Smaller TI, analysis covers more of sample.– Smaller TI, earlier estimates less stable as sample size tiny.

• Then estimate as usual: Will take fractionally longer to produce results.

[email protected] 77

Page 78: Ox Metrics Intro

Recursive Analysis Post-Estimation

• Recursive analysis is all post-estimation. Hit Test menu.

– Recursive analysis option now possible.

• Range of graphics possible in resulting menu.

– Choosing all will result in very small plots, hard to see.38

• First plot regression coefficients: Beta coefficient +/- 2 SE.

– t-stats can be inferred from this plot via SEs so don’t clutter by plotting t’s also.

38Can always copy and paste some to a new graphics file though (Using Ctrl+N).

[email protected] 78

Page 79: Ox Metrics Intro

Plotting Recursive Regression Coefficients

US lag

2002 2004 2006 2008 20100.0

0.5

1.0

1.5

US lag

Constant

2002 2004 2006 2008 2010

0

10Constant

China

2002 2004 2006 2008 2010

−0.01

0.00

0.01

0.02China

China lag

2002 2004 2006 2008 2010

−0.02

−0.01

0.00

0.01

China lag

Spot ExchangeRate (log)

2002 2004 2006 2008 2010

0

5Spot ExchangeRate (log) Spot Exchange Rate lag (log)

2002 2004 2006 2008 2010

0.0

2.5

5.0Spot Exchange Rate lag (log)

1−Month Forward Exchange Rate

2002 2004 2006 2008 2010

0

10 1−Month Forward Exchange Rate 1−Month Forward Exchange Rate lag (log)

2002 2004 2006 2008 2010

0

10 1−Month Forward Exchange Rate lag (log)

• Need to change axes to make plots useful: Much structural instability.39

– Be careful in changing axes: Comparability between plots impaired.

• t-stat significant if both green lines do not include zero.39Make use of Apply button when changing the Y axis values here. To aid visibility, delete Z label also, and relabel.

[email protected] 79

Page 80: Ox Metrics Intro

More Recursive Plots• Residual sum of squares:

∑τt=1 ε

2t , τ = TI, TI + 1, . . . , T .

– If model stable expect this to rise steadily: By σ2 each period.– Jumps indicative of something changing: Residual very large that period.

• 1-step Residuals +/- 2 SE: Final observation residuals:

– yτ − βτxτ , τ = TI, TI + 1, . . . , T .– Points outside standard error bounds (στ) associated with structural change.

• Standardized innovations: Residuals calculated using last period estimates:

– yτ − βτ−1xτ , τ = TI, TI + 1, . . . , T .– Standardised by στ . Large observations suggest structural instability.

RSS

2002 2004 2006 2008 2010

1

2

3RSS Res1Step

2002 2004 2006 2008 2010

−0.25

0.00

0.25

0.50Res1Step Innovs

2002 2004 2006 2008 2010

−0.25

0.00

0.25

0.50Innovs

[email protected] 80

Page 81: Ox Metrics Intro

What are the Chow tests?

• All plots: test statistic scaled by critical value at 1% level.

• 1-step Chow test: Estimate 1, . . . ,m− 1, forecast m.

– Test statistic: FChow1 =RSSm − RSSm−1

RSSm−1/ [(m− 1)− 2]D≈ χ2

1. (7)

• Break-point Chow test: Estimate 1, . . . ,m− 1, forecast m, . . . , T .

– Test statistic: FBreak−Chow =RSST − RSSm−1

RSSm−1/ [(T − 1)− 2]D≈ χ2

T−m+1. (8)

• Forecast Chow test: Estimate 1, . . . ,M − 1, forecast {M}, {M,M + 1}, ...,{M,M + 1, . . . , T}.

– Test statistic: FForc−Chow =(RSSm − RSSM−1)(M − k − 1)

RSSM−1 (m−M − 1)D≈ χ2

m−M+1. (9)

• Tests all very likely to fail if structural change hence useful.

[email protected] 81

Page 82: Ox Metrics Intro

Chow Test Outputs

1up CHOWs 5%

2002 2003 2004 2005 2006 2007 2008 2009 2010

50

1501up CHOWs 5%

Ndn CHOWs 5%

2002 2003 2004 2005 2006 2007 2008 2009 2010

25

50

75Ndn CHOWs 5%

Nup CHOWs 5%

2002 2003 2004 2005 2006 2007 2008 2009 2010

5

10

15 Nup CHOWs 5%

[email protected] 82

Page 83: Ox Metrics Intro

Deterministic Terms

• Already covered creating them in Calculator.

– What about using them?

• Chow tests suggest something happened in 2003 and 2007.

– Can work out date by hovering cursor over graph.– Can also write results instead of graphing in Recursives.– Can also print out largest residuals: See Further output...

• Tasks:

– Determine the dates of structural changes and create dummy variables.– Re-run your model including these structural break terms.– Do they have any effect? If not how might you alter them/the model?

[email protected] 83

Page 84: Ox Metrics Intro

Enough for Today

• Introduction to OxMetrics:

– Keep playing: Can’t include every facet of software.

• Single-equation modelling using PcGive.

• Tomorrow:

– Many of the other possibilities within OxMetrics. . .

[email protected] 84