function forec = faard(y,x,h,m,p);
%Version with dummies
x=x(2:end,:)-x(1:end-1,:);
dy=y(2:end,:)-y(1:end-1,:);
y=y(2:end);
for j=1:size(x,2); x(:,j)=(x(:,j)-mean(x(:,j)))/std(x(:,j)); end;
[coeff, score] = princomp(x);
bigt=length(y);

b=h+p;
w=y(b:bigt)-y(b-h:bigt-h);


q=ones(bigt-b+1,1);
ql=1; 

for i=1:11;
    o1=zeros(12,1); o1(i)=1; o2=kron(ones(30,1),o1); q(:,i+1)=o2(b:bigt); ql(:,i+1)=o2(bigt+h);
end;

for j=1:p; q=[q dy(b+1-h-j:bigt+1-h-j)]; end;
q=[q score(b-h:bigt-h,1:m)]; 

bhat=inv(q'*q)*q'*w;

for j=1:p; ql=[ql dy(bigt+1-j)]; end;
ql=[ql score(bigt,1:m)]; 

forec=ql*bhat;

