I am trying to understand the reasoning behind measurement equations in Smets and Wouters 2007. I do have their mod file but I have (at least) two doubts.

However in Smets and wouters like in many other paper I find a sum and not a minus for the measurement equation, moreover the steady state is not in logarithm as suggested in the previous post:

You are confusing two things here. Ther file in the post uses an nonlinear model and lets Dynare do the log-linearization. In contrast, the Smets/Wouters model is already log-linearized. This explains the different sign (in one case you have to subtract the mean from the model variable to match it to demeaned data while in the other you need to add the steady state to the mean 0 model variable in order to match it to non-demeaned data). All this is explained in See “Remark 10 (Scaling With a Factor 100)” in Pfeifer (2013): “A Guide to Specifying Observation Equations for the Estimation of DSGE Models”.

See Remark 10 (Scaling With a Factor 100) in the linke guide. The gamma = 1.004 is the gross growth rate. By subtracting 1 you get a net growth rate of 0.004 or 0.4 percent (which is what you obtain by multiplying with 100).

So the measurement equation allows me to link observed (differentiated, with mean) values to model variables.

As written in your paper, it is possible to assume that the long term mean is the steady state value and use it to demean the data. What SW do, as you suggest, is to add the model steady state to the linearised (mean=0) variables. This make sense, what is not clear for me is that the model steady state will be different from the data mean. Is this an issue?

As an example

-For the output i use the measurement equation y_obs=y-y(-1)+mu where mu is the long term growth coming from data.

-For interest rate i use r_obs=r+r_ss but r_ss is my model parametric steady state. Is not coming from data.

when r has steady state 0 and r_obs has non-zero steady state, then r_ss must account for the mean. Usually, r_ss=1/beta-1 or something like that, i.e. you can estimate beta by making r_ss and the mean of r_obs equal.

Ok my question was a mess but your answer is exactly what I was asking. My concern was how to link steady-state in measurement equations and real data. It is now clear that for the interest rate the linkage is in the r_ss=1/beta-1 equation, assuming r_ss=mean(r_obs).

In SW I saw that for the hours worked they demean the data and than use a formula of this kind: h_obs=h+0. So I guess that a mixed strategy of imposing measurement equations is it possible (demeaned and non-demeaned data).

In my model I have public surplus and deficit. Unfortunately the model surplus steady-state depends on many variables not observed (such as consumption and capital).

May I calculate the surplus sample mean and use it as the steady-state in the measurement equation instead of using the above formula?

s_obs=s+s_ss where s_ss is the sample mean and s steadu state=0 since the model is linearised.

No, you cannot do that, because surplus_ss is a function of different parameters of the model (e.g. of the tax rate) and not something you can independently estimate. See Remark 4 (Parameter dependence and the use of model-local variables) in the guide.

The only reason to use undemeaned data here is if you need the mean to pin down some parameters of your model like the tax rate. If you already pinned down those parameters, there is no point in using the mean.