GAUSS switchFit Example

Introduction

The following is an example of implementing the switchFit procedure for estimating Markov-Switching models. This example reproduces the GNP results from Hamilton, A New Approach to the Economic Analysis of Nonstationary Time Series and the Business Cycle, Econometrica, March 1989.

Load data

This example loads the data using the GAUSS function loadd. The function loadd utilizes the GAUSS formula string syntax and allows users to load and transform specific variables directly from the dataset.

new;
library tsmt;

// Get file name with full path
fname =  getGAUSSHome() $+ "pkgs/tsmt/examples/gnp82.fmt";

// Load all rows of the variable 'X1'
// from 'gnp82.fmt'
y0 = loadd(fname, "X1");

// Transform data
y = 100*ln(trimr(y0,1,0)./trimr(y0,0,1));

Estimate The Model

The GAUSS function switchFit uses optional inputs to specify the characteristics of the switching model including the number of states and number of lags.

// Estimate the model with 2 states and 4 lags
call switchFit(y, 2, 4);

Output

The output reads

==========================================================
 switchmt Version 3.0.0
========================================================== Beta0 - Constant(s) 5.8 -0.12 standard errors 0.54 0.58 ============================== Phi - Auto-regression coefficients 0.38 -0.50 0.72 -0.0095 standard errors 0.16 0.12 0.13 0.16 ============================== Sigma - Variances 1.4 standard errors 0.29 ============================== P - Transition Probabilities 0.41 0.48 standard errors 0.13 0.11

Have a Specific Question?

Get a real answer from a real person

Need Support?

Get help from our friendly experts.