I see that very often when the command “osr” is used, it is for linear models. For instance, the most common usage is a Taylor rule whereby the other equations are expressing output gap and inflation in terms of other variables.

However, the model I have now are Euler equations, equations from the production sector, external sector etc. and they’re not log-linearized. In such a case, can I still apply the “osr” command?

I refer to my earlier post. I realized that OSR works with any sort of model. But now the thing is how come the optimal values seem to be exactly the values that I initialized?

And then if I don’t initialize, this error pops up:
Error using osr1 (line 51)
OSR: At least one of the initial parameter values for osr_params is NaN

How does this command actually work? So it calculates the optimal values and then have those impulse response functions which are produced taken into account the optimal parameters?

Sorry… another, more specific question: If I use the function
Welfare = Util + beta*Welfare(+1);
as objective function in the OSR command (osr welfare;), does the OSR command than do a second-order approximation of this equation and finds, e.g., the coefficients of a Taylor rule, which maximize welfare in my model?

You can see in the manual that Dynare’s osr-command minimizes a weighted sum of unconditional (co-)variances. For this, you only need a first-order approximation, because by construction there are no linear terms showing up. This in general inconsistent with welfare maximization if there are linear terms showing up in welfare (e.g. the case of a distorted steady state). For those cases, the osr-command is not applicable.

Sorry, I think I didn’t look close enough at the manual…

So, if I understand it correctly now: Let’s say I want to find the coefficients of a Taylor rule which maximize welfare in my model. I have first have to derive the loss function per hand, i.e., do a second-order approximation of utility. Than, from my loss function, I can see which variables are my “y”-variables (endogenous variables whose (co)-variance enters the loss function) and what are the corresponding weights. This is what I pass on to the osr-command and to optim_weights. (And first of all, I have to make sure my steady state is efficient).

Yes, if you want to use the OSR-command, that would be correct. When deriving your welfare function, it must not include linear terms, which is where the efficient steady state comes in. Moreover, you need to be interested in unconditional second moments, not conditional ones. If that is not the case. you need to do it differently.