Out of Sample Forecasting Performance

10 views (last 30 days)
J
J on 22 Apr 2014
Dear All,
Im having some problems with my out of sample performance. Im calculating the out of sample r2 relative to the historical mean but im getting the opposite signs as to what I should expect looking at the literature. Can someone point me in any direction as to what I might be doing wrong? Thanks in advance, see partial code below.
%%Out-Of-Sample Predictive Regression (1)
%Construct matrix of independent variables
X1_US=[us_svar lty us_infl tms tbl us_lpay us_lep us_slep us_ldp us_ldy];
%Construct specifications
whichstats={'yhat','r','standres','rsquare','mse','beta','covb','tstat','hatmat'};
sample=80;
total=152;
variables=10;
time=(length(us_p))-sample;
increments=1;
%Regression log return on matrix
for k=1:variables
for i=1:increments:total-sample
STATS1_US(k,i)=regstats(us_lret(2:80+i,:),X1_US(1:79+i,k),'linear',whichstats);
end
end
%Display MSE for each variable
for j=1:variables
for l=1:increments:total-sample
MSE1_US1(j,l)=(STATS1_US(j,l).r(end,end)).^2;
MSE1_US(j,:)=mean(MSE1_US1(j,:));
end
end
%R Squared calculation
for j=1:variables
R2_1_US(j,:)=1-(MSE1_US(j,:)./US_MSE0(1,1));
end
The Historical Mean I have defined as follow
%%Historical Mean
for i=1:72
us_reth(i,:)=nanmean(us_lret(1:79+i,:));
end
US_MSE0=mean((us_lret(81:end,:)-us_reth).^2);
So even though I should expect negative r2 values, Im getting positive ones. Any help would be greatly appreciated!

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!