-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy path01-Part7.r
53 lines (29 loc) · 775 Bytes
/
01-Part7.r
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
###
### Worksheet Exercise 7.1
###
source('setup_data.R', echo = TRUE);
set.seed(42);
arma11.ts <- arima.sim(list(order = c(1, 0, 1), ar = -0.6, ma = 0.5), n = 1000)
arma11.ts.pacf <- pacf(arma11.ts);
layout(1:2);
plot(arma11.ts);
plot(arma11.ts.pacf);
###
### Worksheet Exercise 7.2
###
source('setup_data.R', echo = TRUE);
set.seed(42);
arma11.fit <- arima(arma11.ts, order = c(1, 0, 1));
print(arma11.fit);
###
### Worksheet Exercise 7.1
###
source('setup_data.R', echo = TRUE);
set.seed(42);
arma22.ts <- arima.sim(list(order = c(2, 0, 2), ar = c(0.2, -0.5), ma = c(-0.1, 0.3)), n = 1000)
arma22.ts.pacf <- pacf(arma11.ts);
layout(1:2);
plot(arma22.ts);
plot(arma22.ts.pacf);
arma22.fit <- arima(arma22.ts, order = c(2, 0, 2));
print(arma22.fit);