Shock selection with inversion filter

@jpfeifer it run for 12 hours and gave results on estimation, also:

dynare_estimation_init: the inversion filter does not support filter_step_ahead. Disabling the option.

dynare_estimation_init: the inversion filter does not support smoothed_state_uncertainty. Disabling the option.

initial_estimation_checks:: The IVF requires exactly as many shocks as observables.

initial_estimation_checks:: The data series inom contains NaN, I am therefore dropping shock epsi for these time points.

Initial value of the log posterior (or likelihood): 1572.0681

and also an error with posterior statistics:

Occbin smoother iteration 1.
occbin.DSGE_smoother: smoother converged.
Index in position 1 exceeds array bounds. Index must not exceed 1.

Error in prior_posterior_statistics_core (line 296)
            stock_filter_step_ahead(:,dr.order_var,:,irun(4)) = aK(options_.filter_step_ahead,1:endo_nbr,:) + constant_part;

Error in prior_posterior_statistics (line 234)
    [fout] = prior_posterior_statistics_core(localVars,1,B,0);

Error in dynare_estimation_1 (line 548)
                        oo_=prior_posterior_statistics('posterior',dataset_,dataset_info,M_,oo_,options_,estim_params_,bayestopt_,dispString); %get smoothed and filtered objects and forecasts

Error in dynare_estimation (line 105)
    dynare_estimation_1(var_list,dname);

Error in NKM.driver (line 942)
oo_recursive_=dynare_estimation(var_list_);

Error in dynare (line 308)
    evalin('base',[fname '.driver']);

I used the command

    // -----------------Occbin ----------------------------------------------//   
    options_.occbin.smoother.debug=1;

    // use inversion filter (note that IF provides smoother together with likelihood)
    occbin_setup(likelihood_inversion_filter,smoother_inversion_filter);
            
           
   estimation(
            datafile=dataobsfile2, mode_compute=6,  cova_compute=1, nobs=120, first_obs=1,
            mh_replic=50000, plot_priors=0, smoother,
            consider_all_endogenous,heteroskedastic_filter,filter_step_ahead=[1:8],smoothed_state_uncertainty);

Is it related to filter_step_ahead=[1:8], smoothed_state_uncertainty commands? and should I just ignore the error?

Yes, it is related to those commands and caused by bugs. Fixes are at 🐛 Enable smoother_inversion_filter option with MCMC (!2325) · Merge requests · Dynare / dynare · GitLab

Hi Johannes

How can I combine dropping the monetary policy shock while also trying to account for the COVID-19 shock. See the following snippet from my code:

% CHECK IF FFR_ELB_US IS AT ELB AND REMOVE DATA + ASSOCIATED SHOCK
    load('est_data_us_1960_2023.mat', 'FFR_ELB_US', 'COVID19_US');

    % Handle EPS_I shock during ELB periods
    verbatim;
        FFR_ELB_US(FFR_ELB_US==0) = NaN;
    end;
    inx_i = strmatch('EPS_I', M_.exo_names);
    if any(isnan(FFR_ELB_US==0))
        M_.heteroskedastic_shocks.Qscale_orig.periods = find(isnan(FFR_ELB_US==0));
        M_.heteroskedastic_shocks.Qscale_orig.exo_id = inx_i;
        M_.heteroskedastic_shocks.Qscale_orig.scale = 0;
    else
        options_.heteroskedastic_filter = false;
    end
    
    % Handle EPS_H shock - enable only during COVID periods
    inx_h = strmatch('EPS_H', M_.exo_names);
    if any(COVID19_US)
        % Disable EPS_H for all periods first
        M_.heteroskedastic_shocks.Qscale_norm.periods = 1:length(COVID19_US);
        M_.heteroskedastic_shocks.Qscale_norm.exo_id = inx_h;
        M_.heteroskedastic_shocks.Qscale_norm.scale = 0;
        
        % Then enable it only for COVID periods
        M_.heteroskedastic_shocks.Qscale_covid.periods = find(COVID19_US == 1);
        M_.heteroskedastic_shocks.Qscale_covid.exo_id = inx_h;
        M_.heteroskedastic_shocks.Qscale_covid.scale = 1;
    end

Here, COVID19_US is a vector of 0 except for 1 for 2020Q2, 2020Q3, and 2020Q4, and EPS_H is a labour supply shock which is meant to capture the effect of lockdowns (it’s specified in the household’s utility function).

However, I’m just not sure if this is the correct approach to do this. Any suggestions or examples I could follow?