proc (1)=bn(inf_ma_coeff,res); /* bn.src is written by Kristian Jönsson (April 10, 2003), Department of Economics, Lund University. Contact info: kristian.jonsson@nek.lu.se This procedure calculates the Beveridge and Nelson (1981, JME) transitory component for a series. Inputs: inf_ma_coeff : A Nx1 vector of infinite MA coefficients for the stationary ARMA series that is to be decomposed. res : A Tx1 vector with residuals from the fitted ARMA process. Output: cyc : A Tx1 vector containing the cyclical component of the ARIMA(p,1,q) process. Comment: The vector of infinite MA coefficients must be calculated so that the approximation of the long-run effect of a disturbance is sufficiently good. At least T coefficients are needed. Note: This code can be used freely as long as proper reference is given. No performance guarantee is made. Bugreports are welcome. */ local trend,cyc; local loadings; local rev_res; local end_vector; local i,j; end_vector=rows(inf_ma_coeff); loadings=zeros(rows(res),1); cyc=zeros(rows(res),1); for i (1,rows(res),1); loadings[i]=sumc(inf_ma_coeff[i:end_vector,1]); endfor; for j (1,rows(res),1); rev_res=rev(res[1:j,1]); cyc[j]=sumc(loadings[1:j,1].*rev_res); endfor; retp(cyc); endp;