Hello everyone.
I have few questions:
 I am trying to find the optimal policy response to different shocks, I was initially taking the welfare function as a the utility function of the household. I looped the policy parameters to get the optimal ones and then used them in the original model to get the optimal responses for my endogenous variables. This is how I initially specified the welfare function:
After a discussion with my professor, he suggested to take the central bank objective function instead of the utility function, in which the central bank aims to minimize the variance of output gap and inflation. Do I just replace “utility” with the central bank policy objective function and loop the model to get the optimal policy parameters as before? if so, how to write the central bank objective function in the codes?
 I looked into Optimal Simple Rule OSR and it seems similar to what I’m trying to do but I need more details on that one. Do you think it is what I am trying to do above and any paper used ors that I can look into it?
Thank you so much for all the help!
One more thing, I asked about it before but did not elaborate.
I am not estimating the DSGE, I am only calibrating the model. However, when I use the following spesfication for interest rate:
[code]exp(R  STEADY_STATE®) = exp((rho_pi*(pi  STEADY_STATE(pi))) + (rho_Y*(Y  STEADY_STATE(Y))));
[/code]
I get that the following:
model_diagnostic: the Jacobian of the static model is singular
there is 1 colinear relationships between the variables and the equations
Colinear variables:
b_star
I
C
L
lammbda
pd_omega
pf_omega
R
w
k
Z
Zn
Y
Yf
Yd
Yx
pi
pi_n
pi_d
pi_f
s
q
pd_bar
pf_bar
n1
n2
j1
j2
Colinear equations
22
22 is the interest rate policy rule specified above! How can I fix this problem?
Before I used R_ss, pi_ss, and Y_ss which are the steady state values that I computed by hand and the interest rate policy rule is specified as following:
code=((exp(Y)/Y_ss)^rho_Y)*((exp(pi)/pi_ss)^rho_pi)*exp(v);
[/code]
I was told before here that it is ok to specify the interest rate rule with R_ss, pi_ss, and Y_ss… which are constant values. Can some one explain why exactly this is ok to do?
Please note that the model is solved either ways but the model with STEADY_STATE give clearer impulse responses. Does having this only Colinear equation cause any problem if I want to use the results?
Thank you so much to everyone for the help, especially to Dr. Pfeifer.
For the steadystateoperator question, see [An infinity of steady states with Taylor rules)
 Yes, you can use any objective function you want as long as you find a recursive representation, but you need to go to second order. That allows you implement the conditional variance as e.g.
(pi(+1)pi_ss)^2. If you are interested in the unconditional variance, you can loop over the required parameters to minimize some linear combination in oo_.var. That is what the osrcommand does.
 SchmittGrohé/Uribe (2007): “Optimal simple and implementable monetary and fiscal rules  Expanded Version” is similar. Note that for the osrcommand, it is the unconditional variance that is minimized.
Thank you so much! still some clarifications please

The welfare function that I am using will be
and will used in the welfare as
welfare = cbo + betta*welfare(+1);
But how I guarantee that it will minimize it? Do I put a negative sign like
Please note that in the matlab looping code I have
Do I have to modify that? I am thinking that the variance is always positive and that either I multiply the central bank objective function with negative to minimize it or I might have to modify the above optimset command.

Is what I did above the conditional variance? what is exactly the difference between them? My understanding that the welfare specified above is conditional on the objective function of the central bank but not sure the conditional variance and unconditional variance? in term of policy advising, which one is used the most? ors or the way I specified above!
 I read the post you mentioned and in that post you state
 How do you know that inflation is not endogenously determined? I think inflation is endogenous variable and I have seen codes using steady_state(pi), does that mean inflation is not endogenous in their model?
 The variables are collinear with only one equation which is the monetary policy function in my case, is that a problem? I mean in term of using the results.
Please talk to your professor about this. It is his job, not mine.
 All Matlab optimizers are minimizers and you want to minimize the weighted sum of variances. But I don’t get why you put it into a welfare function.
 Yes, this would be the conditional variance, because every equation has an conditional expectations operator implicitly in front of it, i.e. E_t. For the unconditional variance, you would need an unconditional expectations operator. As far as I know, the unconditional variance is the one mostly used.
 Please read the whole post. It is steady state inflation I am talking about (of course inflation itself is an endogenous variable). You cannot endogenously determine steady state inflation and the steady state nominal interest rate at the same time due to the Fisher equation linking the two. The steady state inflation rate (a parameter) needs to be prespecified. And yes, of course this is a problem.
Thank you again for all the help! I truly appreciate it.