Zeitreihenanalyse - Übung 3

From StatWiki
Jump to: navigation, search
> pdf(rpdf,width=12)
> 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)
> R = (GDP.ts-lag(GDP.ts,k=-1))/lag(GDP.ts,k=-1)
> # r = log(GDP.ts)-lag(log(GDP.ts),k=-1) # long
> r = diff(log(GDP.ts)) # short
>
> plot(R,type="l",xlab="Year",ylab="GDP")
> lines(r,col=2)
> legend(1995, 0.12, c("R", "r"), col=1:2, lty=1)