Zeitreihenanalyse - Aufgabe 4
From StatWiki
Contents |
Moving average filters
Apply both the simple MA filter with
and the more sophisticated MA filter with
to the log GDP and compare the results.
Apply both the simple MA filter with
and the Spencer filter to the log GDP and
compare the results.
pdf(rpdf, width=8, height=8)
gdpa=readdataSK("GDPA.csv", "csv")
gdpa=data.frame(year=as.numeric(substr(gdpa$DATE,1,4)), gdp=gdpa$VALUE)
gdpa=subset(gdpa, year>=1946)
GDP.ts=ts(gdpa$gdp, start=1946)
GDP.ls <- log(GDP.ts)
par(mfrow=c(2,2))
plot(filter(GDP.ls, c(1/3,1/3)), col=2, main="w=(1/3,1/3)")
plot(filter(GDP.ls, c(1/2,1/3,-1/12)), col=3, main="w=(1/2,1/3,-1/12)")
plot(filter(GDP.ls, c(1/5,1/5)), col=2, main="w=(1/5,1/5,1/5)")
#points(GDP.ls*3/5)
plot(filter(GDP.ls, c(74, 67, 46, 21, 3, -5, -6, -3)/320), col=3, main="Spencer")
#points(GDP.ls*sum(c(74, 67, 46, 21, 3, -8)/320))
#
Complex Numbers
(ii)
(iii)
