Escolar Documentos
Profissional Documentos
Cultura Documentos
0
2
set.seed(1)
w <- rnorm(100)
plot(w, type = "l")
20
40
60
Index
80
100
0.3
0.2
0.0
0.1
Density
0.4
0.5
Histogram of rnorm(100)
0
rnorm(100)
set.seed(2)
acf(rnorm(100))
ACF
Series rnorm(100)
10
Lag
15
20
80
60
40
0
20
200
400
600
Index
acf(x)
800
1000
0.4
0.0
0.2
ACF
0.6
0.8
1.0
Series x
10
15
Lag
acf(diff(x))
20
25
30
0.4
0.0
0.2
ACF
0.6
0.8
1.0
Series diff(x)
10
15
20
25
Lag
30
1992
1994
1996
years
acf(diff(Z.ts))
1998
2000
ACF
xrate
2
Lag
ACF
object$x
2
Lag
Z.hw$alpha
## [1] 1
Z.hw$beta
## [1] 0.167018
www <- "http://staff.elena.aut.ac.nz/Paul-Cowpertwait/ts/HP.txt"
HP.dat <- read.table(www, header = T) ; attach(HP.dat)
plot (as.ts(Price))
45
40
35
30
20
25
as.ts(Price)
100
200
300
Time
DP <- diff(Price)
plot (as.ts(DP))
10
400
500
600
3
2
1
0
2
as.ts(DP)
100
200
300
Time
acf (DP)
11
400
500
600
0.4
0.0
0.2
ACF
0.6
0.8
1.0
Series DP
10
15
Lag
12
20
25
1.0
0.8
0.6
0.4
0.0
0.2
rho(0:10, 0.7)
6
0:10
13
10
1.0
0.5
0.0
0.5
rho(0:10, 0.7)
6
0:10
set.seed(1)
x <- w <- rnorm(100)
for (t in 2:100) x[t] <- 0.7 * x[t - 1] + w[t]
plot(x, type = "l")
14
10
3
2
1
1
20
40
60
Index
acf(x)
15
80
100
0.4
0.2
0.2
ACF
0.6
0.8
1.0
Series x
10
Lag
pacf(x)
16
15
20
0.2
0.2
0.0
Partial ACF
0.4
0.6
Series x
10
Lag
17
15
20
Z.ar$ar
## [1] 0.890261
Z.ar$ar + c(-2, 2) * sqrt(Z.ar$asy.var)
ACF
Series Z.ar$res[1]
10
15
Lag
Reference:
Cowpertwait, Paul SP, and Andrew V. Metcalfe. Introductory time
series withR. Springer Science & Business Media, 2009.
18