Hi,
I too have been puzzling over how to use the VAR/PAC capabilities included in Dynare versions 5.x. I have some comments about the two issues you raise.
(1) The documentation is not clear about the relationship between the auxiliary (VAR or PAC) model and the main model in which an expectation generated by the auxiliary model is needed. Call the first model auxmod and the second mainmod. In general, the variables in auxmod will be a subset of those in mainmod. The purpose of auxmod is to create a formula for the expectation of future values of a variable – the output gap for example – to be used in mainmod, based on the simple structure of auxmod. Since auxmod is linear, this formula will be a linear function of the variables in auxmod. The workflow involves first processing auxmod (ie, dynare auxmod) to create the formula and then placing this formula as an equation in mainmod. However, the Dynare reference manual fails to mention a key command involved in this workflow, which can be either
var_expectation.print(model name) or
pac.print(model name)
One of these commands needs to be in auxmod. Each command writes several files whose contents define the expectatations function in a way that can either be cut and pasted into mainmod or, perhaps, included in mainmod using Dynare’s macro processing language. If xyz is the name of the folder that contains auxmod, these files are written to either
xyx/auxmod/model/var-expectations/
xyz/auxmod/model/pac_expectations/
(2) You wrote:
In our PAC equations we’d like the target in the ECM term to be in levels and the auxiliary VAR to forecast the growth rate of the target in a trend component form pinned with attractors for the growth rate.
This can be done, but to do so involves dealing with two issues. One is how to code the auxiliary VAR. The other involves undoing an error in the one of the Dynare .m files.
Let X be the target variable and DX be a separate variable that is the first difference of X. One could include an equation for DX in the auxiliary model, but the Dynare PAC implementation does not provide a way for the user to indicate that DX is the first difference of X. However, any equation for DX can be transformed into an equation for X by replacing all of its DX terms with diff(X) terms. Care needs to be taken in doing this, as the processor does not permit multiple occurences of diff(X(-j)) to be in the equation.
Suppose that the desired equation is:
diff(DX) = c1*(GR(-1) - DX(-1)) + c2*diff(DX(-1)) + c3*diff(DX(-2)) + ... other terms
GR is the growth rate attractor. The form of the equivalent equation using X rather than DX will need to be:
diff(X) = c1*GR(-1) + (1+c2-c1)*diff(X(-1)) + (c3-c2)*diff(X(-2)) - c3*diff(X(-3)) + ...
Now about the error in one of the .m files, specifically matlab/pac-tools/hVectors.m
. At the bottom of this file are two formulas for the vector H1, whose contents are the coefficients of the formula for the PAC expectation of the weight sum of the future values of delta(X) based on the structure of the auxiliary model. The first formula, which is always used, is correct when the auxiliary model contains an equation for DX. But as I noted, there is no way to implement this. The second formula, which is never used, is correct when the auxiliary model contains an equation for X, which is the only option available. To get the correct outcome in the tests I have been running, I’ve had to edit hVectors.m to modify the following block of code
else
switch auxmodel
case {'var', 'trend_component'}
h1 = A_1*A_b*(kron(iota(m, m)'*inv(eye(m)-G), H')*(tmp\kron(iota(m, m), iota(n, idns))));
case 'Need to check in which case we should trigger this one...'
h1 = A_1*A_b*(kron(iota(m, m)'*inv(eye(m)-G), (H'-eye(length(H))))*(tmp\kron(iota(m, m), iota(n, idns))));
end
end
to be simply
else
h1 = A_1*A_b*(kron(iota(m, m)'*inv(eye(m)-G), (H'-eye(length(H))))*(tmp\kron(iota(m, m), iota(n, idns))));
end
Hope this helps.