Professional Documents
Culture Documents
Ruey S. Tsay-Lec0
Ruey S. Tsay-Lec0
Introduction
Examples of time series used in the lecture. Data can be found on the web at
faculty.chicagobooth.edu/ruey.tsay/teaching/mts/sp2009
1. The monthly unemployment rate of three states in the midwest, namely, Illinois, Michigan
and Ohio.
3. Quaterly data of West Germany, investiment, income and consumption. The data is from
Lutkepohl (2005).
R commands used
% denotes explanation.
> da=read.table("q-gdpun.txt")
> dim(da)
[1] 228 5
> da[1,]
V1 V2 V3 V4 V5
1 1948 1 1 7.3878 3.7333
> gdpun=ts(da[,4:5],frequency=4,start=c(1948,1))
Figure 1: State unemployment rates: 1976-2009
un
12
10
IL
8
6
14 4 6 8 10 12 14 16 4
MI
12
10
OH
8
6
4
Time
> da=read.table("de-inv.txt",header=T)
> da[1,]
inv income cons
1 180 451 415
> dim(da)
[1] 92 3
> de=ts(da,frequency=4,start=c(1960,1))
> plot(de,type=l)
>
> da=read.table("m-dec19.txt",header=T)
> da[1,]
Date dec1 dec9
1 19700130 0.05438 -0.07308
> decile=ts(da[,2:3],frequency=12,start=c(1970,1))
> plot(decile,type=l)
> acf(decile[,1],lag=36)
> par(mfcol=c(2,1))
> acf(decile[,1],lag=36)
> acf(decile[,2],lag=36)
2
%%% More commands used
> da=read.table("gasfur.dat")
> gas=da[,1]
> co2=da[,2]
> dim(da)
> par(mfcol=c(2,1))
> plot(gas,type=l)
> plot(co2,type=l)
> m1=ar(gas)
> names(m1)
[1] "order" "ar" "var.pred" "x.mean" "aic" "n.used" "order.max"
[8] "partialacf" "resid" "method" "series" "frequency" "call" "asy.var.coef"
> m1$order
[1] 14 <== seems too high
> acf(gas)
> pacf(gas) <== Indicates an AR(3) model.
> m1=arima(gas,order=c(3,0,0))
> m1
Call:
arima(x = gas, order = c(3, 0, 0))
Coefficients:
ar1 ar2 ar3 intercept
1.9691 -1.3651 0.3394 -0.0606
s.e. 0.0544 0.0985 0.0543 0.1898
3
[1,] 1.000 -0.484
[2,] -0.484 1.000
> acf(m2$nt)
> pacf(m2$nt) <== Indicates an AR(2) model for Nt series.
> m2=tfm(co2,gas,3,4,2)
[1] "ARMA coefficients & s.e."
ar1 ar2
coef.arma 1.5379 -0.6291
se.arma 0.0470 0.0509
[1] "Transfer function coefficients & s.e."
intercept X
v 53.376 -0.5558 -0.6445 -0.860 -0.484 -0.3633
se.v 0.155 0.0778 0.0812 0.081 0.081 0.0773
> acf(m2$residuals)
4
Figure 2: U.S. bond yields
gdpun
9.0
8.5
gdp
8.0
10 7.5
8
unem
6
4
Time
5
Figure 4: Investment, Income and Consumption of West Germany
1960
1965
1970
de
Time
1975
1980 Figure 5: Deciles 1 and 9 returns
dec9 dec1
Time
decile
1990
2000
6
Figure 6: ACF of Deciles 1 and 9 returns
Series decile[, 1]
0.0 0.4 0.8
ACF
Lag
Series decile[, 2]
0.0 0.4 0.8
ACF
Lag