Suppressing messages from discretionary_policy()

Good morning,

I hope that this is the right forum to ask this question. If not, please accept my apologies, and feel free to move this thread to a different forum as appropriate.

My question concerns the discretionary_policy function. In the code I’m working with, this is called as

discretionary_policy(   
    instruments = (int),
    planner_discount = 1,
    irf = 100,
    nograph,
    noprint
);

causing Dynare to (correctly) remark that with a unity discount factor, the unconditional expected welfare will be infinite (evaluate_planner_objective: the planner discount factor is not strictly smaller than 1. Unconditional welfare will not be finite.)

This is actually no concern (interest lies on the IRFs, not the unconditional welfare), but the call to discretionary_policy is happening in a tight loop that runs thousands of times, and I’m wondering whether there isn’t a way to suppress this message. Looking at evaluate_planner_objective.m, there appears to be no flag for this.

I tried wrapping the call to discretionary_policy in MATLAB’s built-in evalc() to redirect console output to a variable, but the Dynare preprocessor then doesn’t replace the call to discretionary_policy anymore (sensibly, as a general matter, though I’d like for it to happen in this particular case).

Is there a way to suppress these messages, or will I have to live with them? I’ve found nothing on either these forums or Google.

Alternatively, is my assumption that the unity discount factor is truly harmless because I don’t care about unconditional welfare correct, or could this be a problem even if I only care about the IRFs?

Thank you very much for your help!

If you don’t care about the planner objective value, why do you even loop over it?

1 Like

Hello, thanks for taking the time to reply.

I’m interested in the IRFs under discretionary policy, and looping over different values of one of the model’s deep parameters to see how they IRFs change in response to changes of this parameter.

If you could provide me with the codes, I can have a look.

1 Like

Hello, thanks a lot again for taking the time to reply. Here’s a very simple example, investigating how the on-impact reactions of the output gap and inflation rate in the baseline NKM model with optimal discretionary policy depend on the Calvo parameter:

var x ppi int rint nuu;
varexo eta_nuu;
parameters sig bet kap vphi alph1 alph2 alph3;

sig = 2;
eeta = 2;
bet = 0.99;
% ome and kap are set below
vphi = 0.8;
alph1 = 1;
alph2 = 0.5;
alph3 = 0.1;

model(linear);
    x = x(+1) - 1/sig*rint;
    ppi = bet*ppi(+1) + kap*x + nuu;
    rint = int - ppi(+1);
    nuu = vphi*nuu(-1) + eta_nuu;
end;

shocks;
    var eta_nuu; stderr 1;
end;

steady_state_model;
    x = 0;
    ppi = 0;
    nuu = 0;
    int = 0;
    rint = 0;
end;

planner_objective alph1*ppi^2 + alph2*x^2 + alph3*int^2;

ome_vec = 0.01:0.01:0.99;
num_ome = numel(ome_vec);

roi_ppi = NaN(1, num_ome);
roi_x = NaN(1, num_ome);

for ome_idx = 1:num_ome

    ome = ome_vec(ome_idx);
    set_param_value('kap', (sig+eeta)*(1-ome)*(1-ome*bet)/ome);

    discretionary_policy( 
            instruments = (int),
            planner_discount = 1,
            irf = 100,
            nograph,
            noprint
        );

    roi_ppi(ome_idx) = oo_.irfs.ppi_eta_nuu(1);
    roi_x(ome_idx) = oo_.irfs.x_eta_nuu(1);

end

plot(ome_vec, roi_ppi, ome_vec, roi_x)

Use

var x ppi int rint nuu;
varexo eta_nuu;
parameters sig bet kap vphi alph1 alph2 alph3;

sig = 2;
eeta = 2;
bet = 0.99;
% ome and kap are set below
vphi = 0.8;
alph1 = 1;
alph2 = 0.5;
alph3 = 0.1;
ome=0.01;
kap=(sig+eeta)*(1-ome)*(1-ome*bet)/ome;

model(linear);
x = x(+1) - 1/sig*rint;
ppi = bet*ppi(+1) + kap*x + nuu;
rint = int - ppi(+1);
nuu = vphi*nuu(-1) + eta_nuu;
end;

shocks;
var eta_nuu; stderr 1;
end;

steady_state_model;
x = 0;
ppi = 0;
nuu = 0;
int = 0;
rint = 0;
end;

% steady;

planner_objective alph1*ppi^2 + alph2*x^2 + alph3*int^2;

discretionary_policy(
instruments = (int),
planner_discount = 1,
irf = 100,
nograph,
noprint
);

ome_vec = 0.01:0.01:0.99;
num_ome = numel(ome_vec);

roi_ppi = NaN(1, num_ome);
roi_x = NaN(1, num_ome);

for ome_idx = 1:num_ome

    ome = ome_vec(ome_idx);
    set_param_value('kap', (sig+eeta)*(1-ome)*(1-ome*bet)/ome);

    [info, oo_] = stoch_simul(M_, options_, oo_, var_list_);
    if info(1)==0
        roi_ppi(ome_idx) = oo_.irfs.ppi_eta_nuu(1);
        roi_x(ome_idx) = oo_.irfs.x_eta_nuu(1);
    else
        error('Invalid draw')
    end

end

plot(ome_vec, roi_ppi, ome_vec, roi_x)
1 Like

Excellent! This works; thank you very much indeed for your kind support.