Error: 'here' undefined

Hello People, I am getting an error " ‘here’ undefined ". Can somebody suggest what is this?
I am attaching my mod and steady-state.m file.
Thank You!

MSP.mod (9.6 KB)
MSP_steadystate.m (6.3 KB)

Why is there a # in your steady state file? Also, in your steady state file, it should not be

%% Enter model equations 
here

but

%% Enter model equations here

That is, the here must be commented out.

Thank you so much Professor. I corrected it. I have used hash(#) sign becasue I want to declare a local variable (which must not be declared). Should I use the whole expression in fzero command inplace of #fun.

Secondly, now I am getting error : “L_r undefined”. But I have defined it in my mod file.

Why am I getting "L_r undefined " error now?

MSP_steadystate.m (6.6 KB)
MSP.mod (9.6 KB)

The steady state file is not Dynare code, but Matlab code. That’s why model-local variables (#) do not work there. Similarly

exp(L_r)	= 1 - omega ;

is not a proper Matlab assignment. You would need

L_r	=log(1 - omega);

Generally, I cannot recommend full exp()-substitution as it creates a lot of problems that can be circumvented. See Question about understanding irfs in dynare

Thank you Professor! Without this forum and you, I doubt what would be the learning speed of a newcomer like me!!

Professor, all of the equations in my .mod file are in exp() form.

But in the steady-state.m file, I can comfortably solve for steady state only when my equations are in level form.

So I think, if I can transform “ys” vector (which gives steady state solution of endogenous variable) into “log(ys)”, then it will solve my problem. So, Please guide me how can I modify my steady-state.m file so that it gives “log of ys” in place of just “ys”.

Thanks again :slight_smile: !!!

MSP_steadystate.m (5.6 KB)
MSP.mod (9.6 KB)

If really ALL variables are in exp(), then you need to replace

eval(['ys(' int2str(ii) ') = ' varname ';']);

by

eval(['ys(' int2str(ii) ') = log(' varname ');']);

at the end of the steady state file.

Thanx again, But why would someone get error: The initial values for the steady state of the following variables are complex?MSP.mod (9.6 KB)
MSP_steadystate.m (5.7 KB)

Because your steady state computations are wrong. Y_v is -114 as L_g=254

Professor, I was reading the document “Solution and Estimation Methods for DSGE Models”. There it was mentioned that:

“In log-CRRA utility function, labor (L) does not
have a natural unit, so we can fix its deterministic steady state value say at 1”.
Following which I assumed both L_p and L_r both to be 1 in my model with two types of households (Poor and Rich). With this and P_v =1, I could solve for the steady state analytically.
But now I have run into problem since my equations are in log.

Any suggestions ?

That is why I recommend to first get the model to run without an exp()-substitution and then add auxiliary variables for the logs.