/************ Fractional differencing operator    ************
Date: 11 Jun 1998
Author: Heiko Ebens <heiko@jhu.edu>
*************************************************************/

proc (1) = filt_fi(y,d);
/*
**  Purpose: fractional filter e=(1-L)^d
**
**  Format : { e } = filt_fi(y,d);
**
**  Input  : y     = data series (T x 1)
**           d     = fractinal difference (1 x 1)
**
**  Output : e     = fractionally differenced series (T x 1)
**
**
**  Note   : - Formula taken from J. R. M. Hosking "Fractional
Differencing",
**             Biometrika (1981), 68 (1), pp. 165-76, equation 2.1
*/
local t, k, tmp;

  t=rows(y);

  k = seqa(1,1,t-1);
  tmp = (k-1-d)./k;
  tmp = recsercp(tmp,zeros(t-1,1));

  retp(conv(y,1|tmp,0,t));

endp;

