Consumption equivalence across different models

I’m currently trying to numerically compute consumption equivalence across two regimes (tax and no tax).

Using the code from Born and Pfeifer (2018) as reference, I’ve set up a function to calculate the CE factor:

function outvalue=get_consumption_equivalent_unconditional_welfare(par_value_lambda_ce)

global base_oo base_options base_m permtax_oo permtax_options permtax_m

if par_value_lambda_ce>1 

set_param_value('lambda_ce',par_value_lambda_ce) %set consumption equivalent lambda
var_list_ = {'UTIL','V_CE'};
[info1,oo1] = stoch_simul(base_m, base_options, base_oo, var_list_); %get decision rules and moments
[info2,oo2] = stoch_simul(permtax_m, permtax_options, permtax_oo, var_list_); %get decision rules and moments
if info1(1)
if info2(1)
betta = base_m.params(strmatch('betta',base_m.param_names,'exact'));
outvalue = 1/(1-betta)*oo2.mean(strmatch('UTIL',var_list_,'exact')) - oo1.mean(strmatch('V_CE',var_list_,'exact'));

But unfortunately I get the following error:

Dot indexing is not supported for variables of this type.

Error in stoch_simul (line 21)
if isequal(options_.order,0)

Error in get_consumption_equivalent_unconditional_welfare (line 11)
[info1,oo1] = stoch_simul(base_m, base_options, base_oo, var_list_); %get decision rules and moments

Error in csolve (line 60)

My initial guess was that stoch_simul cannot treat base_options as a structure when it is declared as a global object. But then I had a look back at the reference code and saw that options_ was also declared as a global object:

Any assistance or suggestions would be appreciated.

Can you please provide the full set of files that generate the error.

Thanks Johannes. I’ve DM’d the necessary files.
(will share results here once complete)

The problem comes from the use of global variables in your code. I amended the original example code to eliminate the globals.