In: Statistics and Probability
Consider the following times-series where the data is recorded weekly
Data collected over 36 weeks
t |
X |
t |
X |
t |
X |
t |
X |
t |
X |
t |
X |
1 |
9.8 |
7 |
36.4 |
13 |
53.4 |
19 |
99.2 |
25 |
105.3 |
31 |
141.3 |
2 |
9.0 |
8 |
51.0 |
14 |
66.6 |
20 |
90.4 |
26 |
116.7 |
32 |
151.8 |
3 |
10.5 |
9 |
51.1 |
15 |
70.6 |
21 |
91.2 |
27 |
113.2 |
33 |
151.1 |
4 |
20.6 |
10 |
46.9 |
16 |
76.4 |
22 |
94.9 |
28 |
120.5 |
34 |
156.4 |
5 |
28.1 |
11 |
50.5 |
17 |
88.4 |
23 |
94.2 |
29 |
124.2 |
35 |
155.9 |
6 |
28.3 |
12 |
58.5 |
18 |
98.6 |
24 |
104.1 |
30 |
130.2 |
36 |
160.0 |
Conduct an AR(1) process on a new time-series obtained after a carefully chosen transformation, and assess the level of serial correlation via an auto-correlation test.
Here I attach the R code with output
x=c(9.8,9.0,10.5,20.6,28.1,28.3,36.4,51.0,51.1,46.9,50.5,58.5,53.4,66.6,70.6,76.4,88.4,98.6,99.2,90.4,91.2,94.9,94.2,104.1,105.3,116.7,113.2,120.5,124.2,130.2,141.3,151.8,151.1,156.4,155.9,160.0)
ts.plot(x)
y=log(x,base=exp(1))
ts.plot(y)
acf(y)
diff=diff(y)
acf(diff)
m=arima(x,order = c(1,0,0))
m
r=residuals(m)
Box.test(r,type = "Ljung-Box")
acf(r)
serialCorrelationTest(y, test = "rank.von.Neumann",
alternative = "two.sided", conf.level = 0.95)
From the acf of plot of residual given below we can confirm that the residual arev uncorrelated. it satisfies the assumptions of residual. And it is confirmed by Ljung box test.
Here from the serial correlation test the p value is 0.04<0.05. Hence we reject the null hypothesis that is rho =0.
here the data is suitable for AR(1) model it satisfies all the assumption.