Can you forecast next year’s inflation from its own past? Has a policy change shifted the path of exports? Economics theses often work with a single variable observed monthly, quarterly or yearly, and the standard starting point is an ARIMA model. Building one is a disciplined sequence rather than trial and error: make the series stationary, identify candidate models, estimate, check the residuals and forecast. This guide follows the seven Box-Jenkins steps with Stata and R commands, then shows how to report the results.
This article is part of our guide How to Write a Master’s Thesis by the Mastermind PhD team and relates to our Statistical Analysis service. Sources last checked: November 2026.
What is an ARIMA model? An ARIMA model (autoregressive integrated moving average) describes a time series using its own past values (the AR part, order p), the number of differences needed to make it stationary (the I part, order d) and past forecast errors (the MA part, order q). It is written ARIMA(p, d, q); a seasonal version, SARIMA, adds seasonal terms.

When is an ARIMA model the right choice?
Use an ARIMA model when your aim is to describe the dynamics of one series or to forecast it in the short run, and when you have enough observations (Box and Jenkins suggested at least 50 for reliable identification). If your question is about the causal effect of one variable on another, consider ARIMAX (an ARIMA model with explanatory variables), VAR models or cointegration methods instead.
| Research aim | Suitable method |
|---|---|
| Forecast one series | ARIMA or SARIMA |
| Effect of a policy at a known date | Intervention ARIMA or segmented regression |
| One series explained by others | ARIMAX or regression with ARMA errors |
| Interactions among several series | VAR or VECM |
| Long-run relationship of non-stationary series | Cointegration (Engle-Granger, Johansen, ARDL) |
How do you build an ARIMA model in 7 steps?
Step 1: Declare and plot the series
tsset month
tsline cpi
Look for trend, seasonality, structural breaks and outliers. Transform with logs if the variance grows with the level.
Step 2: Test for stationarity
dfuller cpi, trend lags(4)
pperron cpi, trend
The augmented Dickey-Fuller test (Dickey and Fuller, 1979) has a unit root as its null hypothesis, so a non-significant result means the series is non-stationary. Many theses add the KPSS test, whose null is stationarity, as a cross-check (kpss is a user-written Stata command; tseries::kpss.test() in R).
Step 3: Difference until stationary
dfuller D.cpi, lags(4)
The number of differences needed is d. Most economic series need d = 1; rarely d = 2.
Step 4: Identify p and q from the ACF and PACF
corrgram D.cpi, lags(24)
ac D.cpi
pac D.cpi
| Pattern | Suggests |
|---|---|
| ACF decays gradually, PACF cuts off after lag p | AR(p) |
| ACF cuts off after lag q, PACF decays gradually | MA(q) |
| Both decay gradually | Mixed ARMA(p, q) |
| Spikes at lags 12, 24 (monthly data) | Seasonal terms |
Write down two or three candidate models rather than one.
Step 5: Estimate the candidate models
arima cpi, arima(1,1,1)
estat ic
Repeat for each candidate and compare the information criteria (AIC and BIC; lower is better). In R, forecast::auto.arima() searches automatically, but your thesis should still justify the final choice.
Step 6: Check the residuals
predict res, residuals
wntestq res, lags(12)
estat aroots
The Ljung-Box Q test (Ljung and Box, 1978) should be non-significant, meaning the residuals behave like white noise. estat aroots checks that the AR roots lie inside the unit circle (stationarity) and the MA roots too (invertibility). If residuals still show autocorrelation, return to step 4.
Step 7: Forecast and evaluate
Hold out the last part of the sample (for example the final 12 months), estimate the ARIMA model on the rest, forecast the held-out period and compute RMSE and MAE. Then re-estimate on the full sample for the final forecast.
predict cpi_f, y dynamic(tm(2024m1))
📱 Ask a statistician about your data — Send a short description of your instrument and sample size on WhatsApp and get a suitable analysis plan. Every analysis comes with the raw SPSS file and a results report.
How do you handle seasonality?
Monthly and quarterly economic data often repeat a pattern each year. A seasonal ARIMA model is written ARIMA(p,d,q)(P,D,Q)s, where s is 12 for monthly and 4 for quarterly data, and P, D and Q are the seasonal counterparts of p, d and q. In Stata:
arima cpi, arima(1,1,1) sarima(0,1,1,12)
In R, auto.arima() searches seasonal orders automatically when the series is declared with a frequency, for example ts(cpi, frequency = 12). Alternatively, use data already seasonally adjusted by the statistical office, and say so.

How do you interpret the coefficients?
The coefficients of an ARIMA model describe dynamics, not causal effects. An AR(1) coefficient of 0.6 on the differenced series means that 60% of last period’s change carries over to this period; an MA(1) coefficient shows how much of last period’s unexpected shock feeds into the current value. In the discussion chapter, focus on what the dynamics imply (persistence of shocks, speed of adjustment) and on forecast accuracy, rather than on individual coefficient significance.
How do you report an ARIMA model in a thesis?
A complete report includes:
- the data source, frequency, period and any transformation (logs, differences);
- stationarity test results in a table (test, statistic, critical value or p-value, decision) for levels and differences;
- ACF and PACF plots;
- a comparison table of candidate models with AIC, BIC and Ljung-Box p-values;
- the coefficients of the chosen model with standard errors;
- out-of-sample accuracy measures and a forecast plot with prediction intervals.
A typical thesis scenario (illustrative)
This is a constructed example, not real results. A student models monthly consumer price inflation over 15 years. The ADF test does not reject a unit root in the log price index but rejects it after first differencing, so d = 1. The ACF of the differenced series shows significant spikes at lag 12, so the student compares ARIMA(1,1,1), ARIMA(2,1,0) and a seasonal ARIMA(1,1,1)(0,1,1)12. The seasonal ARIMA model has the lowest AIC and clean Ljung-Box results, and its 12-month holdout RMSE is lower than that of a simple random-walk benchmark, which the student reports as evidence that the model adds forecasting value.
What are the common mistakes?
- Estimating on non-stationary data without differencing.
- Choosing the model by the highest R-squared rather than information criteria and diagnostics.
- Ignoring seasonality in monthly or quarterly data.
- Reporting only in-sample fit without an out-of-sample test.
- Ignoring structural breaks (crises, policy regimes) that make standard unit root tests misleading; the Zivot-Andrews test allows one break.
- Claiming causality from a univariate ARIMA model.
📱 Ask on WhatsApp now — 5 years of experience across all disciplines and 14 academic services. Two-stage payment (80/20); revisions are free until supervisor approval, within 30% of the chapter.

Frequently asked questions
How many observations does an ARIMA model need?
Box and Jenkins recommended at least 50 observations, and more for seasonal models. With short annual series, keep the model simple and acknowledge the limitation.
What software can I use?
Stata (`arima`), R (`forecast`, `fable`), EViews and Python (statsmodels) all estimate ARIMA models. Hyndman and Athanasopoulos’s free online textbook uses R and explains each step clearly.
What is the difference between ARIMA and ARMA?
ARMA models a stationary series directly. ARIMA adds differencing (the I part) so it can model series with a unit root.
Should I use logs?
Logs stabilize a variance that grows with the level and make differences approximately equal to growth rates, which is common for prices and GDP.
Can I add explanatory variables?
Yes. ARIMAX, or regression with ARMA errors, includes other variables. In Stata, list them after the dependent variable in the `arima` command.
Sources
- Box, G. E. P., Jenkins, G. M., Reinsel, G. C., & Ljung, G. M. (2015). Time series analysis: Forecasting and control (5th ed.). Wiley.
- Hyndman, R. J., & Athanasopoulos, G. (2021). Forecasting: Principles and practice (3rd ed.). OTexts. https://otexts.com/fpp3/
- Dickey, D. A., & Fuller, W. A. (1979). Distribution of the estimators for autoregressive time series with a unit root. Journal of the American Statistical Association, 74(366), 427-431. https://doi.org/10.1080/01621459.1979.10482531
- Ljung, G. M., & Box, G. E. P. (1978). On a measure of lack of fit in time series models. Biometrika, 65(2), 297-303. https://doi.org/10.1093/biomet/65.2.297
- StataCorp. Stata time-series reference manual: arima. https://www.stata.com/manuals/tsarima.pdf (accessed November 2026)
Sources last checked: November 2026. This article is general educational guidance and does not replace your university regulations or your supervisor’s instructions. How we prepare our content.

