# Determining order of SARIMA model by ACF/PACF (and dealing with seasonality)

I have a ts that has the average monthly measure of pollutants in the air and i'm trying to use a SARIMA$$(p,d,q)(P,D,Q)$$ to model it but I'm having trouble determining the order because I'm somehow not able to remove the seasonality from the data.

So, because there's both trend and seasonality I took the 12th difference to account for the high yearly average in the summer months, and then plotted the decomposed series

m_diff1 = diff(m_ts, 12)
plot(m_diff1)

plot(decompose(m_diff1))


which gave me:

Which is weird to me because it got rid of the linear trend and not the seasonal trend? And when I decided to difference again (this time by 1) to "account" for the linear trend but I still wasn't able to remove the seasonality.

Nonetheless the PACF and ACF plots look like this: , Which I'm not sure they tell me much considering I wasn't able to successfully deal with the seasonality in the time series. Also, side-note I'm doing this all in R, here's some of the series:

    structure(c(158.149232493735, 179.540288982211, 141.55529618627,
150.845437794367, 168.274600153682, 189.320502016778), .Dim = c(6L,
1L), .Dimnames = list(NULL, "total"), .Tsp = c(2001, 2001.41666666667,
12), class = "ts")


and I'm using this site: https://online.stat.psu.edu/stat510/lesson/4/4.1 as a guide

So, how can I properly deal with the seasonality and trend to eventually get the correct ACF/PACF so I can determine the order of the SARIMA model? TIA.

Edit: The .csv from which my time series is coming from:

structure(list(month = c(1, 2, 3, 4, 5, 6), year = c(2001, 2001,
2001, 2001, 2001, 2001), date = structure(c(11338, 11367.5, 11397,
11427.5, 11458, 11488.5), class = "Date"), BEN = c(4.28886198366742,
4.38743793320742, 3.11104641427313, 2.56016353321633, 2.70548122626857,
2.74478118843687), CO = c(1.15802566116617, 1.23165656956996,
0.833924652172606, 0.684889720572276, 0.773497978874483, 0.729142271395529
), EBE = c(3.93199632361959, 4.19389259556923, 2.96451683519944,
2.74148728405705, 3.01795589827371, 3.22289424876417), NMHC = c(0.238906290845672,
0.255622885192273, 0.173836570596142, 0.122209842180147, 0.154969322011947,
0.182527304410567), NO_2 = c(57.0312570252329, 64.6602424449942,
49.3705168821429, 53.0761352674492, 64.0999323771752, 67.647206830732
), O_3 = c(19.5139354574232, 20.5383038087111, 29.0497742674487,
40.2824860453053, 41.0452354173344, 46.1043441730726), PM10 = c(29.449900436516,
37.2815273458053, 24.9915362792256, 25.72564503371, 28.8485156121304,
39.3479598829578), SO_2 = c(24.97849825792, 29.0985261701844,
18.5026587019837, 15.1563261270824, 14.7196862860246, 15.2449743549489
), TCH = c(1.54189654517488, 1.54131730478954, 1.43556658648871,
1.34656043877617, 1.39043968735192, 1.39899987053764), TOL = c(16.0159545121689,
16.351761924188, 11.1219189967391, 9.14953450201853, 11.5188863482367,
12.6976718915217), station = c(28079021.6430525, 28079021.6153846,
28079022.2668467, 28079021.9261736, 28079021.8, 28079021.9223757
), day = c(16, 14.5, 16, 15.5, 16, 15.5), total = c(158.149232493735,
179.540288982211, 141.55529618627, 150.845437794367, 168.274600153682,
189.320502016778)), row.names = c(NA, -6L), groups = structure(list(
month = c(1, 2, 3, 4, 5, 6), .rows = list(1L, 2L, 3L, 4L,
5L, 6L)), row.names = c(NA, -6L), class = c("tbl_df",
"tbl", "data.frame"), .drop = TRUE), class = c("grouped_df",
"tbl_df", "tbl", "data.frame"))

• Why do you apply seasonal differencing to begin with? I see quite a lof of questions where seasonal differencing is taken as the first step when dealing with seasonal data (and simple differencing for trending data). There is no reason to do that without having established that the data are seasonally integrated, as otherwise one has to deal with the problem of overdifferencing. I wonder where this strange habit is coming from. It did not seem common when I was studying time series analysis some 10-12 years ago. Perhaps this is coming from the machine learning literature? Sorry for the rant. Mar 24 '20 at 20:28
• @RichardHardy Haha no worries, rant away my friend. I'm pretty new to this so I was just following a guide ( online.stat.psu.edu/stat510/lesson/4/4.1), in which they suggested to difference wrt the seasonality first, and then wrt the linear trend. Mar 24 '20 at 21:31
• The psu reference "general guidelines are: If there is seasonality and no trend, then take a difference of lag S. For instance, take a 12th difference for monthly data with seasonality" is in my opinion is quite presumptive and should not generally be followed . Over differencing like any transformation can have unexpected and unwanted consequences. A safety play would be to introduce a sar and examine the resulting coefficient. Mar 25 '20 at 10:13
• Indeed, the advice cited by @IrishStat is misguided, and the following suggestion of IrishStat is sound. Mar 25 '20 at 17:27
• @IrishStat Thank you for the suggestion and advice!. If I can ask another question though-- Say I am overdifferencing, what's the reason for the "decomposed" plot to still show a seasonal component even after I took the 12th difference (and also the first)? Mar 25 '20 at 19:32

From the PSU website "Almost by definition, it may be necessary to examine differenced data when we have seasonality. Seasonality usually causes the series to be nonstationary because the average values at some particular times within the seasonal span (months, for example) may be different than the average values at other times. For instance, our sales of cooling fans will always be higher in the summer months." https://online.stat.psu.edu/stat510/lesson/4/4.1 That made sense to me, the mean always changing over time which I thought always created non-stationarity. What was said on this page (what IrishStat said) makes sense to me. I think running an ADF and KPSS test and looking at the ADF and PACF is required, right?

"...I took the 12th difference to account for the high yearly average in the summer months..."

Therein lies your problem. You're over-differencing stationary data.

The first difference operator (seasonal or not seasonal) is only appropriate when data series is $$I(1)$$---in particular, not stationary.

In your case, applying the seasonal difference $$\Delta_{12}$$ presumes your data consists of 12 non-stationary sub-series, one for each month. Clearly this assumption is not reasonable for your data.

For example, applying $$\Delta_{12}$$ would be appropriate for an SARIMA$$(0,0,0)\times(0,1,0)_{12}$$ series, which consists of 12 random walks, one for each month. Your data looks nothing like that.

It's not surprising that seasonality remains in your series after 12th difference. For example, applying $$\Delta_{12}$$ erroneously to a stationary SARIMA$$(0,0,0)\times(0,0,0)_{12}$$ series gives a SARIMA$$(0,0,0)\times(0,0,1)_{12}$$ series. The seasonality is not removed.

(The point of ARIMA modeling is to incorporate, not remove, multiplicative seasonality.)