PSTAT174 – Homework 3 (Solution)

$ 20.99
Category:

Description

Alex Wako
1
x1 = UnempRate logx1 = log(x1) dlogx1 = diff(logx1) ddlogx1 = diff(dlogx1, 12)
plot.ts(cbind(x1, logx1, dlogx1, ddlogx1), main = “”)

Time
sarima(ddlogx1, 0, 1, 1, 1, 0, 0, 12) # The Seasonal ARIMA model
## initial value -2.558221
## iter 2 value -2.938052
## iter 3 value -2.963814
## iter 4 value -2.977279
## iter 5 value -2.977581
## iter 6 value -2.981767
## iter 7 value -2.983573
## iter 8 value -2.984825
## iter 9 value -2.985008
## iter 10 value -2.985039
## iter 11 value -2.985050
## iter 12 value -2.985050
## iter 12 value -2.985050
## iter 12 value -2.985050
## final value -2.985050
## converged
## initial value -2.957893
## iter 2 value -2.957980
## iter 3 value -2.958376
## iter 4 value -2.958406
## iter 5 value -2.958425
## iter 5 value -2.958425
## iter 5 value -2.958425
## final value -2.958425
## converged

LAG ÷ 12 Theoretical Quantiles
p values for Ljung−Box statistic

## $fit
##
## Call:
## arima(x = xdata, order = c(p, d, q), seasonal = list(order = c(P, D, Q), period = S),
## xreg = constant, transform.pars = trans, fixed = fixed, optim.control = list(trace = trc,
## REPORT = 1, reltol = tol))
##
## Coefficients:
## ma1 sar1 constant
## -0.8445 -0.5054 0e+00
## s.e. 0.0248 0.0313 2e-04
##
## sigma^2 estimated as 0.002677: log likelihood = 1251.6, aic = -2495.21 ##
## $degrees_of_freedom
## [1] 810
##
## $ttable
## Estimate SE t.value p.value
## ma1 -0.8445 0.0248 -34.0281 0.0000
## sar1 -0.5054 0.0313 -16.1380 0.0000
## constant 0.0000 0.0002 0.1068 0.9149
##
## $AIC
## [1] -3.069134
##
## $AICc
## [1] -3.069097
##
## $BIC ## [1] -3.046006
prediction1 <- sarima.for(x1, 12, 0, 1, 1, 1, 0, 0, 12) # Forecast of the next 12 months

Time
prediction1$pred
## 2017 4.754517 4.677452 4.600386 4.290383 4.135672 4.602128 4.602708 4.525643
## Sep Oct Nov Dec
## 2017 4.370931 4.293866 4.061509
2
temp <- read.table(“Problem2.txt”, header = T, sep = “,”) x2 <- ts(temp$Value, start = c(1948, 1), frequency = 12) logx2 = log(x2) dlogx2 = diff(logx2) ddlogx2 = diff(dlogx2, 12)
plot.ts(cbind(x2, logx2, dlogx2, ddlogx2), main = “”)

Time
sarima(ddlogx2, 0, 1, 1, 1, 0, 0, 12) # The Seasonal ARIMA model
## initial value -2.158985
## iter 2 value -2.463714
## iter 3 value -2.537353
## iter 4 value -2.539319
## iter 5 value -2.553933
## iter 6 value -2.561164
## iter 7 value -2.563693
## iter 8 value -2.565696
## iter 9 value -2.566640
## iter 10 value -2.567212
## iter 11 value -2.567329
## iter 12 value -2.567357
## iter 13 value -2.567357
## iter 14 value -2.567357
## iter 14 value -2.567357
## iter 14 value -2.567357
## final value -2.567357
## converged
## initial value -2.561744
## iter 2 value -2.561903
## iter 3 value -2.567387
## iter 4 value -2.567734
## iter 5 value -2.568936
## iter 6 value -2.569614
## iter 7 value -2.571693
## iter 8 value -2.572800
## iter 9 value -2.574053
## iter 10 value -2.574211
## iter 11 value -2.574600
## iter 12 value -2.574792
## iter 13 value -2.574979
## iter 14 value -2.575121
## iter 15 value -2.575122
## iter 15 value -2.575122
## iter 15 value -2.575122
## final value -2.575122
## converged

LAG ÷ 12 Theoretical Quantiles
p values for Ljung−Box statistic

## $fit
##
## Call:
## arima(x = xdata, order = c(p, d, q), seasonal = list(order = c(P, D, Q), period = S),
## xreg = constant, transform.pars = trans, fixed = fixed, optim.control = list(trace = trc,
## REPORT = 1, reltol = tol))
##
## Coefficients:
## ma1 sar1 constant
## -1.0000 -0.4851 0
## s.e. 0.0031 0.0295 0
##
## sigma^2 estimated as 0.005728: log likelihood = 1025.53, aic = -2043.07 ##
## $degrees_of_freedom
## [1] 884
##
## $ttable
## Estimate SE t.value p.value
## ma1 -1.0000 0.0031 -319.1882 0.0000
## sar1 -0.4851 0.0295 -16.4593 0.0000
## constant 0.0000 0.0000 0.0149 0.9882
##
## $AIC
## [1] -2.303348
##
## $AICc
## [1] -2.303317
##
## $BIC ## [1] -2.281757
prediction2 <- sarima.for(x2, 12, 1, 0, 1, 1, 0, 0, 12) # Forecast of the next 12 months

Time
prediction2$pred
## 2024 4.454732
## Sep Oct Nov Dec
## 2024

Reviews

There are no reviews yet.

Be the first to review “PSTAT174 – Homework 3 (Solution)”

Your email address will not be published. Required fields are marked *