Testing Assumption of Stationarity (KPSS test) for ARIMA Models

I was wondering if anyone has any experience with creating ARIMA models. As I understand it, the main underlying assumption of an ARIMA model is stationarity, which can be tested using the KPSS test.

The steps that I used for creating my ARIMA model are:

  1. Uploading the data into R (data.dat) using the code
data.dat <- read.csv("data.csv")
  1. Viewing the format of the data (shown below)
    Date, Discharge
    2010-05-01, 0.941
    2010-05-02, 0.528
    2010-05-03, 0.422
    2010-05-04, 0.366
    2010-05-05, 1.381

  2. Creating an object named "disch" using the code

disch <- data.dat$Discharge 
  1. Converting the data into a time series object using the code
disch.ts <- ts(disch)
  1. Seasonally adjusting the time series data using the code:
dischComp <- decompose(disch.ts) # decomposes the time series
dischSeasAdj <- disch - dischComp$seasonal # removes the seasonal component
  1. Using the seasonally adjusted data to create a time series object using the code:
dischSeasAdj.ts <- ts(dischSeasAdj.ts) # puts the data in time series format 
  1. Smoothing the time series data using the code:
dischSMA40 <- SMA(dischSeasAdj.ts, n = 40) 
  1. Using the smoothed time series and ensuring that it is properly defined as a time series object using the code:
dischSMA40.ts <- ts(dischSMA40) 

I now want to use the dischSMA40.ts object to create an ARIMA model. I know that one of the assumptions required for an ARIMA model is stationarity, which can be tested using the KPSS test. However, I am unsure if I complete the KPSS test on the original time series (i.e., disch.ts), the seasonally adjusted time series (i.e., dischSeasAdj.ts), or on the smoothed moving average of the time series (i.e., dischSMA40.ts). Can anyone provide any advice as to where in the process I am to apply the KPSS test? TIA

Generally on the original data, although I'm not sure there's really a rule.

Ok, thank you. Just to clarify, if my original data (i.e., disch.ts) is stationary, than it won't matter for my analysis if the seasonally adjusted (i.e., dischSeasAdj.ts) or smoothed moving average (i.e., dischSMA40.ts) are non-stationary?

If you make those adjustments to a stationary series and it becomes nonstationary then something is very weird. But in the end, you don't want to estimate an ARMA model on a nonstationary series however it got there.

Thanks. I agree that I don't think that I would want to estimate an ARIMA model on a nonstationary time series. I just cannot figure out why it is becoming non-stationary.

Maybe you can post your data using dput() if it isn't crazy too long to see if anyone can spot anything. Or maybe results of the various kpss tests.

Hi startz, I saw a fellow Ph.D. student at my university this afternoon and told him that I was having issues with making adjustments to a stationary series and having it become non-stationary. He suggested using the set.seed() function to define the start date of my time series. As soon as I did this, everything remained stationary. Thanks for you help this afternoon.

set.seed() controls random number generation, so I don't see why it matters here. But I guess if it works, it works.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.