# How to investigate annual time series data?

I have annual time series data from 2000 to 2020. The brand has introduced new marketing camping in 2010 and I want to investigate the impact of this policy, that's why I am trying to explore the trend. In case of monthly data I would decompose it into seasonality and trend components but I only have annual data and that's an issue.

R Code:

library(forecast)

year <- c("2000", "2001", "2002", "2003", "2004",
"2005", "2006", "2007", "2008", "2009", "2010", "2011", "2012",
"2013", "2014", "2015", "2016", "2017", "2018", "2019", "2020")
sales <- c(21524785976, 20788220636, 20103157749, 23266090815,
28135206873, 30621196496, 35219067283, 38372121399, 41400013521,
31744808119, 40970654696, 49762785203, 48477334132, 50052144873,
53705925977, 48359389061, 46836934926, 50341098361, 54225979785,
53706776803, 50864932473)

df <- data.frame(year, sales)

#Create time series
df.ts <- ts(df[,c("sales")],start=c(2000))


Now I want to obtain Stochastic and deterministic trends as given on this link. however when I apply it there is ARIMA(0,0,0) instead of ARIMA(2,0,0).

#Apply Stochastic trend
trend <- seq_along(df.ts)
(fit1 <- auto.arima(df.ts, d=0, xreg=trend))
Series: df.ts
Regression with ARIMA(0,0,0) errors

Coefficients:
intercept        xreg
20009874233  1810698122
s.e.   1036863859   101903292

sigma^2 = 1.973e+19:  log likelihood = -495.25
AIC=996.5   AICc=997.91   BIC=999.63


The same happens in case of a deterministic trend, there is ARIMA(0,1,0) instead of ARIMA(0,1,1) and consequently output is different.

#Apply deterministic trend
(fit2 <- auto.arima(df.ts , d=1))

Series: df.ts
ARIMA(0,1,0)

sigma^2 = 2.104e+19:  log likelihood = -473.31
AIC=948.62   AICc=948.84   BIC=949.62


Could you explain why it happens? Also, which algorithm/technique/method could you suggest (besides Moving-Average) in order to investigate the impact of the campaign? I am open to discussion.

I would be very careful about fitting an ARIMA model to a time series that has only 21 observations, especially if there is a predictor involved.

We see an upward trend, then a sharp downturn in 2009 (presumably due to the worldwide financial crisis in that year), then the trend picks up again for two years, finally the series plateaus.

The "standard" way of doing your analysis would be to introduce a predictor that is 0 for 2000-2009 and 1 for 2010-2020, then regress your time series on it and perhaps finally model the residuals using ARIMA. Unfortunately, auto.arima() complains that it "does not find a suitable ARIMA model", which per above, I fully understand. We can also run this regression and plot the time series of residuals (which is what auto.arima() unsuccessfully tried to model):

predictor <- c(rep(0,10),rep(1,11))
summary(auto.arima(df.ts,xreg=predictor))
model <- lm(df.ts~predictor)
plot(ts(residuals(model),start=start(df.ts)))


We again see the upward trend and the plateau. For all we could say, the new marketing campaign might have interrupted a period of linear growth and throttled the growth to zero, leaving you with the flat line ever since. There is simply too little data here to tell. If you could get your hands on monthly data, or on the components that make up total sales, you might be able to tease out something.

In any case, if your question just is how to fix ARIMA orders, take a look at stats::arima(), especially its order parameter. However, I reiterate that I would counsel against a deep analysis of this kind. Paul Goodwin once said he would not trust a new forecasting method that was tested on fewer time series than the method had words in its name - here, I would not put much stock in an analysis that takes more words to describe than you have observations in your time series.

• Thank you @Stephan for your complete answer! Honestly, my goal is to explore/measure the impact of this campaign on sales, and since I had time series data, I thought ARIMA would work. I would be glad to hear any other suggestions (I can open new question) Commented Jul 22, 2022 at 19:35
• Unfortunately, I don't really think there is a lot to be done with just 21 data points, a predictor and a major economic downturn and upswing in the middle. (I'm not even writing about the impact of COVID on your last data point.) I think you would need to collect a lot more data. Maybe the new marketing campaign focused on certain product groups, and you could get more fine-grained data for those? Right now, there is really very little signal, and a lot of noise. Commented Jul 22, 2022 at 19:40
• stats.stackexchange.com/questions/624959/… Commented Aug 26, 2023 at 9:01