# Loss in Dynare and Loss in Matlab

1. Yes, those are simulated ones, because you only simulated the model.
2. Of course you could use the variance formula. It would give exactly the same result.

Dear community,

Iam still stucked with this problem. As I found out the shock is an on-off shock and the loss is not computed as stochastic sequences of shocks. So, iam still wondering why

w_pi = 0.5 ;
w_x = 0.25;
LossVal = w_pi * var(v_solution(2,:)) + w_x * var(v_solution(1,:));

give me the right loss?

Again, you need to tell us clearly what you are trying to do and what the welfare objective is.

Dear Prof. Pfeifer,

I just want to compute the loss of a hybrid nkm in commitment and discretion as I did with dynare. The way and the code for dynare to calculate the loss is clear. My results are right.

I computed both model with matlab too, but do not get the right loss. This is my Matlab Code under commitment.

My welfare function is:
Jo=1/2*(pi^2 + lambda*x^+2) where lambda is equal to one.

It seems so simple but still I have problems

This is my matlab code
COMMITMENT.m (3.7 KB)