
%% forecasts with shaded high regime
clearvars -except sentiment;
load ECON_variable_a.mat
Mt=aligned_Yt;

A1=[ones(DataSize,1) Mt(1:DataSize)];
nlag=12; % HJTZ_RFS_14 choose nlag=12 but NRTZ_MS_14 choose nlag=0 for clacluating the Newey_west t-stat, But I found there is no big difference
RegressionCoef1=nwest(100*Rt(1:DataSize),A1,nlag);
FC_ECON=RegressionCoef1.yhat;

load NONFUND_variable_new.mat
Mt=aligned_Mt;

A2=[ones(DataSize,1) Mt(1:DataSize)];
nlag=12; % HJTZ_RFS_14 choose nlag=12 but NRTZ_MS_14 choose nlag=0 for clacluating the Newey_west t-stat, But I found there is no big difference
RegressionCoef2=nwest(100*Rt(1:DataSize),A2,nlag);
FC_NONFUND=RegressionCoef2.yhat;

A3=[ones(DataSize,1) aligned_Yt aligned_Mt];
nlag=12; % HJTZ_RFS_14 choose nlag=12 but NRTZ_MS_14 choose nlag=0 for clacluating the Newey_west t-stat, But I found there is no big difference
RegressionCoef3=nwest(100*Rt(1:DataSize),A3,nlag);
FC_ALL=RegressionCoef3.yhat;

yavg=100*mean(Rt(1:DataSize));

load dataPT.mat
Ih=Ih';

subplot(3,1,1)
x=1965+7/12:1/12:2010+12/12;
plot(x,FC_ECON,'-k',x,yavg,'-r')
hold on;
yl=ylim
grayColor = [1 1 1] * 0.8;
hBarsDown = bar(x,yl(1) * Ih, ...
'FaceColor', grayColor, 'BarWidth', 1, 'lineStyle', 'none');
% Plot gray bars going Up.
hBarsUp = bar(x,yl(2) * Ih, ...
'FaceColor', grayColor, 'BarWidth', 1, 'lineStyle', 'none');
alpha(0.55);
title('Panel A. forecasts based on ECON')
hold on;
subplot(3,1,2)
x=1965+7/12:1/12:2010+12/12;
plot(x,FC_NONFUND,'-k',x,yavg,'-r')
hold on;
yl=ylim
grayColor = [1 1 1] * 0.8;
hBarsDown = bar(x,yl(1) * Ih, ...
'FaceColor', grayColor, 'BarWidth', 1, 'lineStyle', 'none');
% Plot gray bars going Up.
hBarsUp = bar(x,yl(2) * Ih, ...
'FaceColor', grayColor, 'BarWidth', 1, 'lineStyle', 'none');
alpha(0.55);
title('Panel B. forecasts based on NONFUND')
hold on;
subplot(3,1,3)
x=1965+7/12:1/12:2010+12/12;
plot(x,FC_ALL,'-k',x,yavg,'-r')
hold on;
yl=ylim
grayColor = [1 1 1] * 0.8;
hBarsDown = bar(x,yl(1) * Ih, ...
'FaceColor', grayColor, 'BarWidth', 1, 'lineStyle', 'none');
% Plot gray bars going Up.
hBarsUp = bar(x,yl(2) * Ih, ...
'FaceColor', grayColor, 'BarWidth', 1, 'lineStyle', 'none');
alpha(0.55);
title('Panel C. forecasts based on ECON and NONFUND together')



