In: Statistics and Probability
Fit an appropriate seasonal ARIMA model to the log-transformed Johnson and Johnson earnings series (jj) of Example 1.1. Use the estimated model to forecast the next 4 quarters.
**using R**
**using library "astsa" **
**using data "jj"
*** the data used in example 1.1 is the same data meant to be used for this question, but for this question we are supposed to log transform it ***
****
to access data:
install.packages("astsa")
data("so2")
****
UR_DATA <-
read_csv("C:/Users/swapnil.soni01/Desktop/UR_DATA.csv")
attach(UR_DATA)
initial examination of the data,
UR=as.ts(UR)
plot(UR)
#NO SEASONALITY; no trend
#Stationarity test
adf.test(UR)
transformations, if necessary, &
initial identification of the dependence orders and degree of
differencing,
#now let's difference series & check
UR_d1=diff(UR)
adf.test(UR_d1)
#now series is stationary
parameter estimation,
#ACF & PACF plot
acf(UR_d1) #MA order=1
pacf(UR_d1) #AR order=2
#estimate ARIMA model
model=arima(UR,order=c(2,1,1))
Call:
arima(x = UR, order = c(2, 1, 1))
Coefficients:
ar1 ar2 ma1
-0.7999 -0.4548 0.1290
s.e. 0.3290 0.2110 0.3552
sigma^2 estimated as 0.05501: log likelihood = 0.46, aic = 7.08
residual diagnostics and model choice.
plot(model$residuals)
#test for autocorrelation
Box.test(model$residuals)
Box-Pierce test
data: model$residuals
X-squared = 0.06046, df = 1, p-value = 0.8058
yes residuals are free from autocorrelation (so, white noise)
(F) Use the estimated model to forecast the next 12 months.
forecast(model)
plot(forecast(model))
Point Forecast Lo 80 Hi 80 Lo 95 Hi 95
27 3.492477 3.191907 3.793047 3.032795 3.952159
28 3.479451 3.163029 3.795874 2.995525 3.963377
29 3.474190 3.134513 3.813867 2.954699 3.993682
30 3.484323 3.092380 3.876266 2.884898 4.083748
31 3.478610 3.066688 3.890533 2.848629 4.108591
32 3.478572 3.040522 3.916622 2.808633 4.148511
33 3.481201 3.013985 3.948416 2.766656 4.195745
34 3.479115 2.990920 3.967311 2.732485 4.225745
35 3.479588 2.968223 3.990952 2.697524 4.261652
36 3.480158 2.946336 4.013981 2.663747 4.296570
Note: We used Indian unemployment data from WB source:
year | UR |
1991 | 3.996 |
1992 | 3.901 |
1993 | 4.06 |
1994 | 3.7 |
1995 | 3.974 |
1996 | 3.951 |
1997 | 4.386 |
1998 | 4.119 |
1999 | 4.215 |
2000 | 4.31 |
2001 | 3.775 |
2002 | 4.316 |
2003 | 3.929 |
2004 | 3.889 |
2005 | 4.4 |
2006 | 4.331 |
2007 | 3.724 |
2008 | 4.154 |
2009 | 3.906 |
2010 | 3.55 |
2011 | 3.537 |
2012 | 3.623 |
2013 | 3.574 |
2014 | 3.53 |
2015 | 3.49 |
2016 | 3.458 |