Performs a Beveridge-Nelson decomposition on the series y. It is assumed that y can be represented as an ARIMA process. See Hamilton(1995) "Time Series Analysis", section 17.5. The BNdecomp() function accepts the following parameters: y : the series to decompose auto : Boolean flag (see below) p : int, AR order (max 6, default 6) q : int, MA order (max 6, default 6) verbose : Boolean flag, operate verbosely (default=yes) If the boolean switch "auto" is true (as per default), then the ARIMA orders will be chosen by minimizing the BIC criterion among all the ARIMA models with maximum orders p and q. Otherwise, an ARIMA(p,1,q) will be used. If the "verbose" parameter is non-zero, details of the decomposition are shown. Returns the trend component in a new series. CHANGELOG: 2.0 -> 2.1: Add description to the return series; increase the maximum orders from 4 to 6 update the help text; slightly modernise internal code; update sample script.