IRF and Correlations

I have a couple of questions. I understand that Dynare is calculating the matrix of correlation from the simulated data. If I don’t specify Dynare to detrend the simulated data, then the raw simulated data is used which is the data with a trend? The second question I have is suppose I have two variables x and y and a exo shock z. Suppose that the irf shows that both x and y increases following an increase in z. Both x and y goes back to SS after a while but their response is always positive until reaching SS. I don’t understand how I can get such an IRF and yet Dynare is telling me that the HP filtered correlation between x and y is negative. Am I missing something here (the correlation from the raw data is positive as in the IRF). Thank you for answering these questions.

First, model variables are always stationary (at least they do not the contain the trend of the data). That is for example why you need observation equations matching model variables to the data. See e.g. my “A Guide to Specifying Observation Equations for the Estimation of DSGE Models” at

The positive conditional correlation after a shock (and the raw data) and having a negative correlation after HP filtering is common. The reason is that the HP filter filters out some low-frequency components responsible for the positive correlation you observe in the real data.