Commit 717095ae authored by MichelJuillard's avatar MichelJuillard

fixed bug at order 2, when a variable is absent at the current period;

cleaned code that is useless since we transform leads and lags on
period > 1 (hand cherry-picked from 0303b1c0)
parent b4189182
This diff is collapsed.
...@@ -38,9 +38,9 @@ endo_nbr = M_.endo_nbr; ...@@ -38,9 +38,9 @@ endo_nbr = M_.endo_nbr;
lead_lag_incidence = M_.lead_lag_incidence; lead_lag_incidence = M_.lead_lag_incidence;
klen = max_lag + max_lead + 1; klen = max_lag + max_lead + 1;
fwrd_var = find(any(lead_lag_incidence(max_lag+2:end,:),1))'; fwrd_var = find(lead_lag_incidence(max_lag+2:end,:))';
if max_lag > 0 if max_lag > 0
pred_var = find(any(lead_lag_incidence(1,:),1))'; pred_var = find(lead_lag_incidence(1,:))';
both_var = intersect(pred_var,fwrd_var); both_var = intersect(pred_var,fwrd_var);
pred_var = setdiff(pred_var,both_var); pred_var = setdiff(pred_var,both_var);
fwrd_var = setdiff(fwrd_var,both_var); fwrd_var = setdiff(fwrd_var,both_var);
...@@ -61,11 +61,11 @@ inv_order_var(order_var) = (1:endo_nbr); ...@@ -61,11 +61,11 @@ inv_order_var(order_var) = (1:endo_nbr);
if max_lag > 0 if max_lag > 0
kmask = []; kmask = [];
if max_lead > 0 if max_lead > 0
kmask = [cumsum(flipud(lead_lag_incidence(max_lag+2:end,order_var)),1)] ; kmask = lead_lag_incidence(max_lag+2,order_var) ;
end end
kmask = [kmask; flipud(cumsum(lead_lag_incidence(1,order_var),1))] ; kmask = [kmask; lead_lag_incidence(1,order_var)] ;
else else
kmask = cumsum(flipud(lead_lag_incidence(max_lag+2:klen,order_var)),1) ; kmask = lead_lag_incidence(max_lag+2,order_var) ;
end end
kmask = kmask'; kmask = kmask';
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment