Você está na página 1de 7

VI.

ANALYSIS AND DISCUSSION (Code input and Output)


setwd("C:\\Users\\se7en\\Desktop")
Y<-read.table("timeseries.txt.txt ",header=TRUE)
plot.ts(x = Y, ylab = expression(paste(Y[t]," (export volume
index)")), xlab = "t (Year) ",type="o", col = "red", main = "Time
Series with 16 values")

ACF <- acf(x=Y, lag.max = 15, type = c ("correlation"), plot = TRUE)

ACF$"acf"[2:16]
[1] 0.747010464 0.510874178 0.238122449 0.005676017 -0.187818571
[6] -0.165416131 -0.167339752 -0.139557065 -0.155305290 -0.165771437

[11] -0.275418418 -0.269032582 -0.206288111 -0.155269981 -0.114465769

Y <- ts(Y)
Z <- ts(diff(Y, lag=1))
Z2 <- ts(diff (Z, lag=1))
ts.plot(Y,gpars=list(main="Original Values", xlab="Year",
ylab="Export Volume Index", lty=1))

acf(Y)

pacf(Y)

ts.plot(Z, gpars=list(main= "First Difference", xlab="Year",


ylab="Export Volume Index", lty=1))

acf(Z, main="Z")

pacf(Z, main="Z")

Box.test(Z, lag = 5)
Output
Box-Pierce test

data: Z
X-squared = 2.9786, df = 5, p-value = 0.7033

Box.test(Z, lag = 5,type="Ljung")


Output
Box-Ljung test
data: Z
X-squared = 4.4428, df = 5, p-value = 0.4876

ts.plot(Z2, gpars=list(main= "Second Difference", xlab="Year",


ylab="Export Volume Index", lty=1))

acf(Z2, main="Z2")

pacf(Z2, main="Z2")

Box.test(Z2, lag = 5)
Box-Pierce test
data: Z2
X-squared = 4.5467, df = 5, p-value = 0.4737
Box.test(Z2, lag = 5,type="Ljung")
Box-Ljung test
data: Z2
X-squared = 6.7073, df = 5, p-value = 0.2433

Você também pode gostar