Hi I want to know how can I optimize the weight of lambda because I use:
but I have to put the value of lambda1 above and the results changes everytime I change the value of lambda1.
Is there a way to make the program find the value of lambda1 that minimizes the loss function??
Your question makes no sense. You are telling Dynare to find the minimum of
Clearly, as you are considering the sum of two positive things, the minimum is for lambda equal to 0. Think about it this way: lambda measures the strength of the tradeoff between fluctuations in y and p. Of course the policy maker would be happy if there would be no tradeoff (p=0), but it makes no sense to search for the minimizing value.
Yes I understand your point. But what value of lambda1 do I have to use?
There are no guidelines. Either you pick some loss function in an adhoc-way or you try to derive the parameter from microfoundations as e.g. in Gali’s (2008) textbook.