## Tutorial 2 - A Simple Macroeconomic Example

### Introduction

A popular, simplistic macroeconomic model is the linear Keynsian macroeconomic model, which is characterized by the following equation:
Y = C + I + G + NX
The above equation, however, makes up only part of a more complete model. The model can be expanded as follows:
Yt = Ct + It + Gt + NXt
YDt = Yt - Tt
Ct = β0 + β1 YDt + β2 Ct-1 + ε1t
It = β3 + β4 Yt + β5 rt-1 + ε2t
rt = β6 + β7 Yt + β8 Mt + ε3t
The system contains two equations defined as identities. The other three require regression analysis to determine the unknown coefficients. Of particular interest is the Koyck distributed lag consumption function. The consumption is determined logically from the disposable income and the consumption from the previous period.
This example features multiple variables that are simultaneously determined, namely consumption, output, investment, disposable income, and interest rates. Some variables, our instruments, are determined outside the system, such as the net exports, government spending, taxes, and lagged values. Determination of the consumption function coefficients requires some special consideration because both consumption and disposable income are determined simultaneously in this system.

### Loading the Data

The example data is stored in the example/tutorial2 directory in the file tutorial2-start.sql-draco. This file contains a collection of United States of America's Bureau of Economic Analysis combined with data taken from the Economic Report of the President. The data contains the following variables:

Variable | Description
Time | Year
Y | Real GDP
C | Consumption
I | Investment
EX | Exports
IM | Imports
G | Government Expenditures
M1 | M1 Money Supply
T | Total Tax Revenues
r | Prime Rate of Interest

An interesting point to note is that the equation:
Y = C + I + G + EX - IM
does not strictly hold for this data set. The failure of this equation is because all variables have been measured separately, meaning error is introduced in the aggregation of each separate component. For the purposes of this example, the data set is sufficient regardless of the slight inconsistency.

### Generate Disposable Income and Net Exports

For the consumption equation, a disposable income is necessary. The data provides both aggregate income and government tax revenue; the disposable income should be the approximate difference between the two. First, create a new column by clicking Data->Column Operations->Add Column (or click the Add (+) button on the toolbar). A new variable should appear with zeros for all years. Next, rename the variable to YD by clicking Data->Column Operations->Rename Column... in the menus while the Data window is focused and the new column is selected. Finally, set the column values by selecting Data->Column Operations->Set Column Values... in the menu while the column is still selected. This operation will open the Set Column Values window. Enter the following expression into the edit box:
Y-T
The disposable income variable should now be fully populated. A similar procedure can be used to create a net exports column to simplify the data set. Again, create a new column and rename it to NX. Set the net exports column to the following:
EX-IM
Since there is now a net exports column, the separate export and import columns can be eliminated from our data set for simplicity. Select the EX column and click Data->Column Operations->Remove Column (or click the Remove (-) button on the toolbar). Confirm the column's removal and perform the same operation for the IM variable.

### Generate Lagged Variables

For our regressions, some lagged variable are also necessary. Draco does not allow for the explicit specification of lagged variables in regressions; instead the user must create new variables with lagged data prior to performing the regression. For this example, lagged versions of both consumption and interest rate are necessary. While the steps above could be followed using the back() function in the Equations dialog, Draco provides a fast solution to this common operation. Select the consumption (C) variable and click Data->Column Operations->Quick-generate Lagged Variable to construct a lagged version of consumption. A new variable, C_lagged, should now be present in the data set. Perform the same operation to generate lagged interest rate as well, creating an r_lagged variable. The data set should now be complete enough to perform further analysis.

### Estimate the Consumption Function

The Koyck distributed lag consumption function must be estimated using Two-Stage Least-Squares (TSLS) fit because the disposable income is an endogenous variable in our system. Note that disposable income is determined from GDP and taxes, but GDP is determined from consumption, which itself is determined from disposable income. Due to the simultaneity of disposable income and consumption, a proxy variable must be used in place of disposable income in the estimate. A TSLS fit provides the proxy variable automagically.
Click on Regress->Two-Stage Least Squares... to open the regression window. In this simple example, the dependent variable is C, and the independent variables are YD and C_lagged (the lagged consumption variable). The TSLS window provides a third column to specify Instruments, variables exogenous to the system. To perform the regression accurately, choose all the following exogenous variables:

Variable | Reason for Instrument
G | Government spending does not depend on other internal variables
NX | Net exports do not depend on other internal variables
T | Taxes do not depend on other internal variables
C_lagged | Lagged consumption was determined in the previous time period, and does not depend on the current period's GDP, disposable income, etc.
r_lagged | Lagged interest rates were determined in the previous time period, and do not depend on the current period's GDP or money supply.

Select all of the above variable as Instruments in the TSLS window. Finally, click on Perform Fit->Compute Regression... to perform the regression. The regression in this case will actually fail with an error similar to the following:

## Results of the Two-Stage Least Squares Regression
Regression Variable: | C
Regression Failed! Regression failed on stage 1: YD RunLS Output: Bad conditioning of independent data matrix RCOND=5.571178650971675E-40

The failure has occurred because the first stage regression of disposable income versus the instrumental variables. The regression was aborted because the independent data matrix in this first stage fit was found to be ill-suited to inversion, a procedure necessary for least-squares fit. This data set, however, is comprised of independently measured data, not derived data; it should be safe to ignore the matrix conditioning.
In most cases, ignoring the failure to regress due to poor conditioning should be heeded. If a regression is started with poor conditioning, Draco can enter a state where the regression never completes. Draco will still respond in this state, however, and all work can be saved before restarting the Draco.

### Estimate the Consumption Function Again

Again, proceed with the instructions above for selecting the variables and instruments after opening a new TSLS regression window. Before performing the regression, disable the conditioning check by clicking Options->Ignore matrix condition for solving in the menus. The regression will now proceed past the first stage if possible. After selecting Perform Fit->Compute Regression...,the results should appear similar to below:

## Results of the Two-Stage Least Squares Regression
Regression Variable: | C
Sum Squared of the Residuals: | 1.4549E05
Standard Error of the Fit: | 58.85674
R-Squared Value: | 0.99888
Adjusted R-Squared Value: | 0.99882
Coefficient | Value | Std. Err. | t-Score
Constant | -49.21995 | 136.32608 | -0.36105
Coef 0 (C_lagged) | 0.99869 | 0.07178 | 13.91423
Coef 1 (YD_HAT) | 0.0393 | 0.08556 | 0.45935

### Examine Residuals from the Fit

As an exercise the residuals from this TSLS regression can be output as a column in the dataset. While the TSLS window is frontmost, click Supporting Data-> Output Residuals to Column, creating a new variable called Residuals. Return to the Data window and click on the Residuals variable. To examine some aspects of the residuals, click on Data->Column Operations->Column Statistics... when the Data window (or click the Sigma symbol on the toolbar). Notice that the mean of the residuals are approaching zero as expected.

### Conclusion

The example above illustrated data manipulation techniques in Draco. New variables were created explicitly for disposable income and net exports, and the ability to quickly generate lagged data was demonstrated. A Two-stage Least Squares regression was attempted in order to determine the estimated coefficients of Koyck distributed lag consumption function. The example data can be further explored to determine remaining unknown coefficients and whether the data exhibits any autoregressive properties.

Copyright © 2008 Approximatrix, LLC
Text licensed under the Creative Commons Attribution-Share Alike 3.0 License
Approximatrix, LLC makes no claims of copyright on any data in this example.
DracoTM and the Approximatrix logo are trademarks of Approximatrix, LLC
Other trademarks are property of their respective owners