function [betagdp betapgdp] = prior(h)
% obtains a point forecast for a constant and the first autoregressive lag
% given the pre-sample data in "DataPriors.xls". Constructs the data for
% multistep-ahead regressions based on a step h.

[rdata labels] = xlsread('DataPrior.xls');

y = diff(log(rdata(:,2)),1)*400;
p = diff(log(rdata(:,3)),1)*400;

if h == 1
    gdp  = y(2:end,:);
    pgdp = diff(p(2:end,:),1);
   
    xgdp = y(1:end-1,:);
    xpgdp = diff(p(1:end-1,:),1);
elseif h==4
    gdp  = y; 
    pgdp = p;
    
    j = 1;
    for i = 1:(size(gdp,1)-3)
        tempgdp(j,1)  = sum(gdp(i:i+3,1))/h;
        temppgdp(j,1) = sum(pgdp(i:i+3,1))/h;
        j = j+1;
    end
 
    gdp = tempgdp(2:end,:);
    pgdp = temppgdp(3:end,:) - pgdp(2:end-4,:);
        
    xgdp = y(1:end-4,:);
    xpgdp = diff(p(1:end-4,:),1);
end

betagdp = regress(gdp,[ones(size(gdp,1),1) xgdp]);
betapgdp = regress(pgdp,[ones(size(pgdp,1),1) xpgdp]);