I want to compare IRFs from a VAR fitted on model-generated data with IRFs from a real-data VAR (in the spirit of Sims-Cogley-Nason approach). I am using the NK-baseline in the Dynare ‘example’ folder. My question is: How should I transform real data to be sure that I estimate the same VAR on simulated data and real ones?

As far as I understand, the NK-baseline is not log-linearized and is entered in stationary form. So the output is represented by stationary variables in levels (Am I Correct?). Suppose that I then fit a VAR on yd, c, PI and R from the model.

Next, I take FRED data on real output (per worker) , consumption, inflation and the Fed Fund. To make the resulting IRFs comparable with those of the model-VAR, Should I (i) detrend the real variables (actually just Y and C) e.g. by first-diff or one-sided HP and then (ii) run the VAR?
Moreover, should I take logged variable to solve scaling issues?

Or, alternatively, Can I use stoch_simul(loglinear) and then use a VAR in log-levels for real data (after having detrended them)?

It’s probably easiest to define growth rates in the model (the log difference of the stationary variables plus the trend growth) and then match that to growth rates in the data for the purpose of estimation. In that case, you will estimate the auxiliary VAR on the same data concept: growth rates of nonstationary variables.

I didn’t get it completely. I simulate the model and take, say, yd, c and PI. To define growth rates I do log(diff(yd). How do I add trend growth then?

Second, if data are nonstationary but not cointegrated, estimating a VAR using growth rates is fine. But if there is cointegration (e.g. between C and Y) estimating a VAR in levels (or a VECM) would be better. Is there any alternative than to fit a VAR in growth rates of nonstationary variables?

Have a look at Pfeifer(2013): “A Guide to Specifying Observation Equations for the Estimation of DSGE Models” sites.google.com/site/pfeiferecon/Pfeifer_2013_Observation_Equations.pdf
at the part with models with explicitly specified trends. You need to add the trend growth factor mu_z back to most variables’ growth rates.

Your model implies cointegration. You could also run a VECM or a VAR in levels. For that, you could simply cumulate the growth rates from the model to obtain levels. You should be able to start at arbitrary initial levels.