The data construction file is a matlab function that is specific to a DSGE model. The function takes no input variables and provides one variable as output. The output variable is a structure with certain required fields and certain optional fields. In the Tables below the structure is simply called StructureForData, but any valid variable name can be used. The name of the file can be any valid matlab function name. This means that you should only use English alpha-numeric characters.
YADA only requires that the data construction file has 4 fields, where 2 among these has 2 sub-fields each. First, the field Y contains the sub-fields data and names. The data field holds an nxT matrix with data on the observed/endogenous variables, with n being the number of variables and T the number of observations. The names sub-field should be a cell array of length n, where each element is a string vector with the name of a variable.
Similarly, the field X is required for any exogenous variables. This field also needs to hold 2 sub-fields: data and names. The sub-field data is either a kxT or an empty matrix, while names is either a k dimensional cell array or empty. The number of exogenous variables is thus either k or 0.
The third required field is sample. This should be a 1x4 vector with start year, start period, end year, and end period for the sample of your data. Finally, the field frequency is needed. This field holds a string vector that is quarterly, monthly, or annual. The first letter in these words suffices. The required fields used in the An and Schorfheide model example that is supplied with YADA are shown in Table 1.
|
|
Table 1: Required fields for the output StructureForData. |
The data construction file can also hold a larger number of optional fields. Some of these are listed in Table 2. For example, you can specify additional sub-fields to the Y field. The sub-field levels is a 0-1 vector that indicate if the variable is in first differences (0) or in levels (1). The sub-field policyrate indicates the position of the monetary policy rate in the sub-field names. This makes it possible to map a zero lower bound for the nominal monetary policy interest rate to an observed variable and is necessary for YADA to solve the linear DSGE model subject to a nonlinear zero lower bound restriction. In case the actual lower bound for this interest rate is regarded as different from zero, then the sub-field ZLBdata makes it possible to set different values. Note that this can either be a scalar or a vector. YADA assumes that the lower bound is a constant in the former case, while YADA allows for the possibility that the lower bound may also be time varying in the latter case, where each element of such a vector is treated as a time period and the position is assumed to be identical to the rows in the matrix Y.data. Next, the sub-field annual is a 0-1 vector that indicates if the variables can be annualized (1) or if its already annualized (0). Data regarding variables to use in a Bayesian VAR model, as well as data for conditional forecasting purposes are also displayed in Table 2.
From Table 2 it can be seen that the conditional forecasting data (conditioning assumptions) in the sub-filed Z.data contains a few NaN values. These values denote a conditioning assumption that should be skipped, i.e., the dimension of the conditioning assumptions can be time-varying. In addition, the sub-field Z.K1 and Z.K2 provide the mapping from the observed variables to the conditioning assumptions. When the Z.K2 matrix is 3-dimensional it acts as a lag-varying matrix on Y(T+i-j) for j = 1,...,g-1, with g being the length of the conditioning sample.
Among the optional fields are also the data transformation data. When present, such functions have to be defined on a variable-by-variable basis. The function itself is specified as a string vector, while initial conditions and exogenous variables are given in a vector and a matrix respectively. While initial conditions and exogenous variables are necessary input, they may hold empty matrices.
Six types of functions can be specified: (1) the general transformation function (fcn), (2) the partial derivative of the general transformation function with respect to the first variable in the function times a part of the variable (the first order Taylor expansion term for the variable), (3) the annualization function (annualizefcn), (4) the partial derivative of the annualization function times a part of the variable (annualizepartial), (5) the inversion function (invertfcn), and (6) the export function (exportfcn). The inversion function needs to be written such that when it is applied to the data after using the general transformation function, the original data is obtained. An example is given in Table 3.
|
|
Table 3: Data for using data transformation functions on the YGR variable in the output StructureForData. |
In addition to the transformation functions for the individual variables, YADA also supports transformations through linear combinations of the observed variables. This invertible transformation matrix should be provided as StructureForData.Y.TransMatrix and it is applied after the individual transformations.
Additional Information
• | A more detailed description about how to setup the data construction file can also be found in Section 18.5 of the YADA Manual. |
• | An example file is located in the directory "example\AnSchorfheide" directly below the base directory for YADA. The file is simply called "DataConstFile.m". |
• | Further example data construction files can be found in the "LubikSchorfheide" and "SmetsWoutersAER" directories in the "example" directory. |
Page url: http://www.texlips.net/yada/help/index.html?data_construction_file.htm