Grid Calculation of Loss Function Values

Dear All,
I am trying to calculate loss function values for two different parameter values. I have a code on matlab (which is a bad modification of any other code I found in this forum) but I am not good at matlab. In loop3.m file, I don’t know how to write my loss function and store it and get the values (as a table or graph or any other way) in this loop.
My loss function will be like L=(1/2*variance.Y+variance.P+variance.b);
How can I get these loss function values for different parameters,
loop3.m (572 Bytes)
RRendiss.mod (3.1 KB)
Any help will be highly appreciated. Thanks

Try loop3.m (794 Bytes)
But you need to fix the parameter dependence in your mod-file first. Use model-local variables.

1 Like

Dear jpfeier,
Thanks a lot for reply.
I am trying to understand model-local variables now.
As I understood, these variables should be defined in the model part as
What should I do is still ambiguous to me. Which equations or variables should be used as model-local variables? And is it related to Steady State levels, should I change them too?
More importantly, am I finding wrong parameter values with osr command when I don’t use model local variables?
A little bit more information would be really helpful,
Thanks a lot.

It’s about the composite parameters set before the model-command :

z1=J/(1-BETAS);                                     %qHstoCs
z2=J*RbSS/((1-BETAB)*RbSS-Kss*(1-BETAB*RbSS));     %qHbtoCb
z3=(J*Kss)/(RbSS*(1-BETAB)-Kss*(1-BETAB*RbSS));       %bSStoCbSS
z4=1-(1-RbSS)*(z3);                                %NbwbtoCb
z5=BETAS/(BETAS*gama*(1-RRRss)+BETAS*RbSS-BETAS-gama);       %bSStoCfSS
z6=((1-ALPHA)/(XSS*z4));                        %CbtoY
z7=(z3/z5)*z6;                                  %CftoY
z8=1-z6-z7;                                     %CstoY
z9=(z1*z8)/(z2*z6);                             %HsSS/HbSS
z90=z3*z6;                                     %btoY
z91=((1/BETAS)-1)*gama*z90+((ALPHA-1)/XSS)+1;  %CstoY
z92=z1*z91;                                   %qHstoY
z93=ALPHA/XSS;                                  %wsNstoY


1 Like