/*
** seqf.src
** Author: Alan G. Isaac
**         mailto:aisaac@american.edu
** Date:   28 June 2000
** Caveat: this code is provided gratis but without
**         any performance warrantee or guarantee
**
**> seqf
**
**  Purpose:    produce an AR(P) series from P initial values
**
**  Format:     x = seqf(f,x0,T);
**
**  Input:      f     pointer to a procedure
**              x0    N x P matrix of initial values
**              T     number of points to add to the series
**
**  Output:     x     the extended series
**
**  Comments:   f should take an N x P matrix as its argument
**                (most recent values are assumed to be leftmost)
**                and return an N x 1 matrix.
**              x is ordered first to last (so rev(x0') is topmost).
**
*/


proc (1) = seqf(f,x0,T);
   local f:proc,N,P,xT;
   N=rows(x0);
   P=cols(x0);
   xT=x0;
   for i(1,T,1);
     xT=f(xT[.,1:P])~xT;
   endfor;
retp(rev(xT'));
endp;
