Dear all,

I am trying to run a Christiano FitzGerald band pass filter to estimate a
long-run trend (with period in excess of 70 years), using the mFilter
package. My data are the demeaned natural log of a commodity price index.
My problem is that the asymmetric CF filter output does not look right
around the start and end points. In particular my long run trend has a peak
a few years before the end point, which I think shouldn’t be there (by
reference to previous work and also just from looking at the data, which
seem to be still trending up).

The R code below should replicate the issue. I also posted this question
and charts here
http://stats.stackexchange.com/questions/69930/band-pass-filter-giving-wrong-turning-pointa
couple of days ago with no answer so far. This post also has a chart
of
the HP filter output for comparison - the HP filter output looks better but
only because there is something wrong with my CF filter - CF is best
practice for this kind of data, I believe.

I’m not sure if the unexpected turning point is the result of my
misunderstanding the CF filter, a consequence of how the filter is
implemented in mFilter, or something else. Any help would be very much
appreciated indeed!

Thanks

Aidan.



library(mFilter)

library(ggplot2)

library(reshape2)

d<-c(1.17, 1.11, 0.68, 0.83, 0.98, 1.01, 0.76, 0.52, 0.34, 0.36,

0.18, 0.12, 0.07, -0.17, -0.47, -0.43, -0.01, -0.16, -0.51, -0.79,

-0.69, -0.76, -0.86, -0.85, -0.78, -0.8, -0.89, -0.95, -0.83,

-0.84, -0.96, -1.22, -1.41, -1.25, -0.94, -0.43, -0.58, -0.97,

-0.82, -0.47, -0.44, -0.56, -0.55, -0.32, -0.31, -0.46, -0.34,

-0.3, -0.25, -0.31, -0.57, -0.6, -0.42, -0.06, -0.3, -0.5, 0.12,

0.3, 0.33, 0.24, 0.49, -0.18, -0.06, -0.15, -0.11, 0.02, 0.14,

-0.3, -0.31, -0.28, -0.39, -0.94, -0.51, -0.74, -0.35, -0.37,

-0.28, -0.22, -0.24, -0.36, -0.37, -0.32, -0.39, -0.45, -0.46,

-0.48, -0.39, -0.21, 0.01, 0.02, 0.01, -0.06, -0.09, -0.04, -0.01,

0, -0.02, 0.03, 0, -0.03, -0.05, -0.06, -0.07, -0.08, -0.11,

-0.13, -0.15, -0.15, -0.18, -0.2, -0.24, -0.23, -0.25, -0.04,

0.86, 0.8, 0.8, 0.81, 0.73, 1.03, 1.36, 1.33, 1.18, 1.06, 0.98,

0.9, 0.22, 0.46, 0.25, 0.4, 0.59, 0.39, 0.33, 0.19, 0.11, 0.14,

0.27, 0.19, -0.16, 0.11, 0.5, 0.32, 0.31, 0.46, 0.72, 1, 1.12,

1.19, 1.47, 0.99, 1.23, 1.38, 1.35)

d<-data.frame(orig.series=d)

d$year<-as.numeric(row.names(d))

filter.output<-cffilter(d$orig.series,pl=70,pu=1500)

d$long.run.trend<-filter.output$cycle

d<-melt(d,id='year')

gp<-ggplot(d) + geom_line(aes(x=year,y=value,colour=variable))

gp

	[[alternative HTML version deleted]]

