Posts

Showing posts from June, 2022

Forecasting with ARIMA: R Code

Step-1:  ###R Packages Installed library(fpp2) library(readxl) library(SPlit) library(fpp2)   ###Declare time-series data ###In this study I have file naming as HPI_AUS. All the date excel format. HPI_AUS <-ts(AUSHPI[,2], start=c(2002,3), frequency=4)   Step-3: ###While forecasting, first that should be done within the sample, and if it is found valid, then only we forrecast out of sample. ###Split the given data into the training and test sets split_HPI_AUS <- ts_split(ts.obj = HPI_AUS, sample.out= 8) training <- split_AUSHPI$train testing <- split_AUSHPI$test length(training) length(testing)  Step-4:###Select the appropriate forecasting tool. Here I have used ARIMA (easy and quick model) ###ARIMA In-sample testing arima_diag(training)     ###Model forecasting In-sample arima1 <- auto.arima(training, seasonal= TRUE) autoplot(arima1) check_res(arima1)   ###Forecasting In-sample fcast1...