How to analyze Arima forecast

x<-File name$frequency

tsData = ts(x, start = c(start year time, 1), frequency = 12 )

plot(tsData)

plot(x)

components.ts = decompose(tsData)

plot(components.ts)

install.packages(“fUnitRoots”)

library(“fUnitRoots”)

urkpssTest(tsData, type = c(“tau”), lags = c(“short”),use.lag = NULL, doplot = TRUE)

tsstationary = diff(tsData, differences=1)

plot(tsstationary)

acf(tsData,lag.max=34)

timeseriesseasonallyadjusted <- tsData- components.ts$seasonal

tsstationary <- diff(timeseriesseasonallyadjusted, differences=1)

plot(tsstationary)

acf(tsstationary, lag.max=34)

pacf(tsstationary, lag.max=34)

fitARIMA <- arima(tsData, order=c(1,0,1),seasonal = list(order = c(0,1,0), period=12), method=”ML”)

install.packages(“lmtest”)

library(lmtest)

coeftest(fitARIMA)

confint(fitARIMA)

acf(fitARIMA$residuals)

qqnorm(fitARIMA$residuals)

qqline(fitARIMA$residuals)

install.packages(“forecast”)

library(forecast)

auto.arima(tsData, trace=TRUE)

predict(fitARIMA,n.ahead = Year number*12)

futurVal <- forecast(fitARIMA,h= Year number*12, level=c(99.5))

plot(futurVal)

Example:

x<-Arima_forecast$frequency
tsData = ts(x, start = c(1981,1), frequency = 12 )
plot(tsData)
plot(x)
components.ts = decompose(tsData)
plot(components.ts)
install.packages(“fUnitRoots”)
library(“fUnitRoots”)
urkpssTest(tsData, type = c(“tau”), lags = c(“short”),use.lag = NULL, doplot = TRUE)
tsstationary = diff(tsData, differences=1)
plot(tsstationary)
acf(tsData,lag.max=34)
timeseriesseasonallyadjusted <- tsData- components.ts$seasonal
tsstationary <- diff(timeseriesseasonallyadjusted, differences=1)
plot(tsstationary)
acf(tsstationary, lag.max=34)
pacf(tsstationary, lag.max=34)
fitARIMA <- arima(tsData, order=c(1,0,1),seasonal = list(order = c(0,1,0), period=12), method=”ML”)
install.packages(“lmtest”)
library(lmtest)
coeftest(fitARIMA)
confint(fitARIMA)
acf(fitARIMA$residuals)
qqnorm(fitARIMA$residuals)
qqline(fitARIMA$residuals)
install.packages(“forecast”)
library(forecast)
auto.arima(tsData, trace=TRUE)
predict(fitARIMA,n.ahead = 120)
futurVal <- forecast(fitARIMA,h=120, level=c(99.5))
plot(futurVal)

Comments

No comments yet. Why don’t you start the discussion?

    Leave a Reply

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