==========================

Core Civic Stock Time Series, 2016

candleChart(CXW, up.col = "black", dn.col = "red", theme = "white")

Log Difference, Core Civic, T, T-1

plot(as.zoo(stock_change), 
     xlab = "Date", 
     ylab = "Log Difference",
     bty="n",
     main= "Core Civic T, T-1 Stock Difference 2016")

Ljung-Box Stationarity Test

# Test for Stationarity #
Box.test(cxw_ts, lag = 20, type = 'Ljung-Box')
## 
##  Box-Ljung test
## 
## data:  cxw_ts
## X-squared = 4267.5, df = 20, p-value < 2.2e-16

Augmented Dickey Fuller Test

adf.test(cxw_ts) # not significant meaning don't have stationarity
## 
##  Augmented Dickey-Fuller Test
## 
## data:  cxw_ts
## Dickey-Fuller = -1.45, Lag order = 6, p-value = 0.8074
## alternative hypothesis: stationary

Autocorrelation Plot

acf(cxw_ts, plot=T, main = "Autocorrelation Plot")

# Partial Autocorrelation Plot

pacf(cxw_ts, plot=T, main = "Partial Autocorrelation Plot")

Difference the Series

plot(tsDiff, main = "First Difference")

Box.test(tsDiff, lag = 20, type = 'Ljung-Box')
## 
##  Box-Ljung test
## 
## data:  tsDiff
## X-squared = 25.51, df = 20, p-value = 0.1826

ACF; PACF Plots

acf(tsDiff, plot=T) # Suggests ARIMA 1 model

pacf(tsDiff, plot=T)

summary(fit)
## Series: cxw_ts 
## Regression with ARIMA(0,1,0) errors 
## 
## Coefficients:
##        drift  Obama_memo  Trump_election
##       0.0026     -7.8126          5.2774
## s.e.  0.0307      0.4851          0.4851
## 
## sigma^2 estimated as 0.2372:  log likelihood=-174.05
## AIC=356.1   AICc=356.27   BIC=370.2
## 
## Training set error measures:
##                        ME      RMSE       MAE        MPE     MAPE
## Training set 0.0001041167 0.4831207 0.3682321 -0.0513006 1.542877
##                   MASE       ACF1
## Training set 0.8733466 0.06216945