Bonus Module·Companion to Module 5

ARIMA in Microsoft Excel

Manual Calculation from First Principles

Learning Objectives

What You Need

In This Bonus Module

1. Why Excel for ARIMA?

When you type ARIMA(y, order=(1,1,0)).fit() in Python, statsmodels runs a sophisticated maximum likelihood optimisation. The output appears in milliseconds. But what actually happened? What equations were solved? What was the computer doing while you waited?

This bonus module rebuilds ARIMA from scratch in Excel — every formula visible, every calculation traceable. By the end, you will understand ARIMA not as a black-box function call, but as a sequence of logical spreadsheet operations you could explain to a student.

💡
Pro Tip: This module is especially valuable if you teach econometrics. When a student asks "how does ARIMA actually work?", you can open this spreadsheet and walk through every cell. The Python version tells you what the answer is; the Excel version tells you why.

Our Dataset

We use 13 quarters of sales data (in ₹ Lakhs) for a small manufacturing firm. The data exhibits a clear alternating pattern in growth — high-growth quarters followed by lower-growth quarters — which makes the AR(1) structure visible:

QuarterPeriod (t)Sales (Yt)ΔYt
2023-Q10100
2023-Q211077
2023-Q321158
2023-Q431227
2024-Q141308
2024-Q251366
2024-Q361448
2024-Q471506
2025-Q181588
2025-Q291646
2025-Q3101728
2025-Q4111786
2026-Q1121868

Look at the ΔY column: 7, 8, 7, 8, 6, 8, 6, 8, 6, 8, 6, 8. High-growth quarters (8) are consistently followed by lower-growth quarters (6 or 7) — this is the negative autocorrelation that an AR(1) model captures.

📝
Excel Layout: Row 1 = Headers. Col A = Quarter, Col B = Period (t), Col C = Sales (Yt), Col D = ΔYt (first difference). Data starts from Row 2. All formulas below assume this layout.

2. Stationarity Testing — Excel Style

Step 1: Visual Inspection (Line Chart)

Select Columns B and C (Period and Sales). Insert a Line Chart. Does the series have a clear upward trend? Yes — sales grow from 100 to 186 over 12 quarters. A trending series is non-stationary.

Step 2: Compare Means and Variances Across Sub-Periods

Split the data into two halves (Periods 0–6 and 7–12). If the series is stationary, the mean and variance should be approximately equal in both halves.

StatisticPeriods 0–6Periods 7–12Equal?
Mean (Y)122.0168.0No — means are very different
Mean (ΔY)7.37.0Approximately equal ✓

Mean Y (Periods 0-6):  =AVERAGE(C2:C8)     → 122.0
Mean Y (Periods 7-12): =AVERAGE(C9:C14)    → 168.0
Mean ΔY (Periods 1-6): =AVERAGE(D3:D8)     → 7.33
Mean ΔY (Periods 7-12): =AVERAGE(D9:D14)   → 7.00
            

Sales means differ substantially (122 vs 168) — strong evidence of non-stationarity. But ΔY means are similar (7.3 vs 7.0) — the differenced series appears stationary.

Step 3: Autocorrelation at Lag 1

A non-stationary series has autocorrelation close to 1.0. A stationary series should have autocorrelation well below 1.0.


Autocorrelation of Y_t   (any cell):  =CORREL(C3:C14, C2:C13)
Autocorrelation of ΔY_t  (any cell):  =CORREL(D4:D14, D3:D13)
            
Results
Autocorrelation of Y_t (Lag 1):   r₁ = 0.996  → Very close to 1.0 → Non-stationary
Autocorrelation of ΔY_t (Lag 1):  r₁ ≈ -0.65  → Well below 1.0  → Stationary ✓

Step 4: First Differencing

Create the first difference column:


Excel (Cell D3):  =C3-C2    (drag down to D14)
            
Decision: The original sales series is non-stationary (trending up, r₁ ≈ 1.0). One difference makes it stationary (means equal across halves, r₁ ≈ -0.65). Therefore, d = 1 in our ARIMA(p,d,q) specification. We will model ΔYt, not Yt.

3. AR(1) Model in Excel — From Equation to Spreadsheet

The AR(1) Equation

We model the stationary differenced series: ΔYt = c + φ₁ · ΔYt-1 + ϵt

Step 1: Create the Lag Column

Create Column E for the lagged differenced series (ΔYt-1):

RowB (t)C (Yt)D (ΔYt)E (ΔYt-1)
20100
311077
4211587
5312278
6413087
... drag down ...
141218686

Excel (Cell E4):  =D3    (drag down to E14)
            

Step 2: Estimate φ₁ and c Using LINEST

LINEST() is Excel's built-in OLS function. We regress ΔYt on ΔYt-1:


Select cells H3:I3, type this formula, press Ctrl+Shift+Enter:
  =LINEST(D4:D14, E4:E14, TRUE, TRUE)
(Regress ΔY_t [Col D, rows 4-14] on lagged ΔY_{t-1} [Col E, rows 4-14])

Results (approximate — your Excel may show slight differences):
  H3 = φ₁ ≈ -0.91   (slope — the AR coefficient)
  I3 = c  ≈ 13.60    (intercept)

Interpretation: ΔY_t = 13.6 - 0.91 × ΔY_{t-1}

When last quarter's growth was high (ΔY = 8):
   13.6 - (0.91 × 8) = 13.6 - 7.28 ≈ 6.3  (a low-growth quarter)

When last quarter's growth was low (ΔY = 6):
   13.6 - (0.91 × 6) = 13.6 - 5.46 ≈ 8.1  (a high-growth quarter)

The negative φ₁ captures the alternating pattern: high → low, low → high.
            
💡
Pro Tip: The AR coefficient φ₁ = -0.91 means the growth rate strongly alternates: a high-growth quarter is almost always followed by a lower-growth quarter. The long-run mean growth is c/(1-φ₁) = 13.6/(1.91) = 7.1 units/quarter — close to the actual average ΔY of 7.08.

Step 3: Compute Fitted Values and Residuals

Col F (Fitted)Col G (Residual)Formula
= I$3 + H$3*E4= D4 - F4Row 4
13.6+(-0.91)×7 = 7.28 - 7.2 = +0.8
13.6+(-0.91)×8 = 6.37 - 6.3 = +0.7
13.6+(-0.91)×7 = 7.28 - 7.2 = +0.8
13.6+(-0.91)×8 = 6.36 - 6.3 = -0.3
13.6+(-0.91)×6 = 8.18 - 8.1 = -0.1
... drag down ...

Cell F4:  =I$3 + H$3*E4    (fitted: c + φ₁ × ΔY_{t-1})
Cell G4:  =D4 - F4          (residual: actual - fitted)
Drag both down to row 14.
            

Step 4: Compute SSE and Approximate AIC

📝
SSE = Sum of Squared Errors (also called RSS = Residual Sum of Squares)
It measures how much the model's predictions miss the actual values. SSE = Σ(Actual - Predicted)2. A lower SSE means the model fits the data better. But SSE alone is not enough — it always decreases when you add more parameters, even useless ones.

AIC = Akaike Information Criterion
AIC solves this by penalising model complexity. Formula: AIC = N × ln(SSE/N) + 2 × k, where N = number of observations, k = number of parameters. The first term rewards good fit (lower SSE); the second term penalises extra parameters. A lower AIC means a better model — one that fits well without unnecessary complexity. When comparing two models, the one with the lower AIC is preferred.

(All formulas below start from Row 4 because Rows 2-3 have no residuals —
 Row 2 has no ΔY, Row 3 has ΔY but no lagged value for the AR equation)

SSE (Cell J3):  =SUMSQ(G4:G14)              → SSE ≈ 3.0
N (Cell J4):    =COUNT(G4:G14)               → N = 11
k (Cell J5):    2                            (c + φ₁ = 2 parameters)
AIC (Cell J6):  =J4*LN(J3/J4) + 2*J5        → AIC ≈ -12
            
AR(1) Results Summary
AR(1) on differenced data:
  φ₁ (AR coefficient) ≈ -0.91
  c  (constant)       ≈ 13.60
  SSE                  ≈ 3.0
  Long-run mean growth = c/(1-φ₁) = 7.1 units/quarter

The strong negative φ₁ captures the alternating boom-slowdown pattern
in the firm's quarterly sales growth.

4. MA(1) Model in Excel — Solver to the Rescue

The MA(1) Equation

ΔYt = μ + ϵt + θ₁ · ϵt-1

The problem: we do not observe ϵt and ϵt-1 — they must be estimated jointly with θ₁. This makes MA models non-linear, and LINEST() (which does linear OLS) cannot estimate them. We need Solver.

Step 1: Set Up Parameter Cells

Important: The AR section already uses columns F–J. The MA model uses separate columns: L for parameters (2 cells only), M–O for the data chain, P for diagnostics.

CellLabelInitial Value
L3μ (constant)7.00
L4θ₁ (MA coefficient)0.00

Step 2: Build the Residual Computation Chain

The MA(1) model has a recursive structure. We initialise ϵ0 = 0 (standard assumption) and compute forward. Parameters are in Col L (L3, L4). The working columns are M (ε_t), N (ε_{t-1}), O (Fitted):

RowD (ΔYt)M (εt)N (εt-1)O (Fitted)
370.0007.00
481.000.007.00
570.001.007.00

Col M — ε_t (MA residuals):
  Cell M3:  =D3 - L$3              → ε₁ = ΔY₁ - μ         (uses parameter from L3)
  Cell M4:  =D4 - L$3 - L$4*M3     → ε₂ = ΔY₂ - μ - θ₁·ε₁ (uses params L3,L4 and previous ε from M3)
  Drag M4 down to M14.

Col N — ε_{t-1} (lagged residuals):
  Cell N4:  =M3                     → simply copies yesterday's ε
  Drag N4 down to N14.

Col O — Fitted values:
  Cell O3:  =L$3 + L$4*0            → fitted = μ + θ₁·0 (since ε₀=0)
  Cell O4:  =L$3 + L$4*M3           → fitted = μ + θ₁·ε_{t-1}
  Drag O4 down to O14.

Col P — Diagnostics (separate from AR's Col J):
  SSE (P3):  =SUMSQ(M3:M14)             → SSE ≈ 4.85
  N   (P4):  =COUNT(M3:M14)             → N = 12
  k   (P5):  2                          (μ + θ₁ = 2 parameters)
  AIC (P6):  =P4*LN(P3/P4) + 2*P5      → calculates automatically
            

Step 3: Run Solver

  1. Data → Solver (if not visible, enable the Solver Add-in)
  2. Set Objective: P3 (SSE) → Min
  3. By Changing Variable Cells: L3:L4 (μ and θ₁)
  4. Solving Method: GRG Nonlinear
  5. Click Solve
Solver Results
μ (constant):       7.08    (≈ mean of ΔY)
θ₁ (MA coefficient): -0.55
SSE:                 4.85   (from Cell P3)
AIC:                 -7.30  (from Cell P6: N×ln(SSE/N) + 2k)

Interpretation: ΔY_t = 7.08 + ε_t - 0.55·ε_{t-1}
A positive shock this quarter is partially reversed next quarter —
the same alternating pattern captured through a different mechanism.
Common Pitfall: Solver may converge to a local minimum. Try different starting values for L3 and L4 (e.g., μ=5, θ₁=0.5) and re-run. If the final SSE is the same, you have found the global minimum. If it differs, use the solution with the lowest SSE. If Solver converges to the same SSE, you have likely found the global minimum. If results differ, use the solution with the lowest SSE.

AR(1) vs MA(1) — Which Fits Better?

Both models have SSE and AIC columns in your spreadsheet. Now compare them side by side:

Modelk (params)SSEAICDecision
AR(1)23.0-12.3✓ Winner
MA(1)24.9-7.3

Why AR(1) wins: Both models use 2 parameters, so the complexity penalty (2k = 4) is the same. AR(1) simply fits the data better — its SSE (3.0) is lower than MA(1)'s SSE (4.9). Lower SSE → lower AIC → better model.

In your Excel, both models now sit side by side:
AR(1): SSE in Cell J3, AIC in Cell J6   (Columns F–J)
MA(1): SSE in Cell P3, AIC in Cell P6   (Columns L–P)
Decision rule: Compare P6 vs J6 — the smaller AIC wins.

5. Full ARIMA(1,1,0) — The Complete Walkthrough

We now combine everything into ARIMA(1,1,0): p=1 (one AR term), d=1 (one difference), q=0 (no MA terms). Because q=0, there is no MA estimation step in this workflow — the model uses only AR(1) on the differenced data. The 9 steps below cover identification (d), estimation of AR via LINEST, diagnostics, and forecasting:

ARIMA in Excel — Complete Process

Step 1: Plot Yt
Visible trend? Means differ across halves?
Yes → Series is non-stationary
need to DIFFERENCE once: d = 1
Step 2: Create ΔYt column (=C3-C2)
Model ΔY (changes) instead of Y (levels)
No → Series is already stationary
no differencing needed: d = 0
Skip differencing
Model Y directly — it's already stable
Step 3: Create lag column (ΔY_{t-1} in Col E)
Step 4: LINEST to estimate φ₁ and c
Step 5: Compute fitted values and residuals
Step 6: Compute SSE and AIC
Step 7: Residual check — do residuals look random?
Step 8: Forecast ΔY_{13} and ΔY_{14}
Step 9: Recover Y forecast: Y_{13} = Y_{12} + ΔY_{13}
📝
What does d mean? ARIMA(p,d,q) has three numbers: p = number of AR terms (how many past values of the series predict today), d = number of times you difference the data to make it stationary, q = number of MA terms (how many past shocks affect today).

d = 0: The original series is already stationary — no differencing needed. Model Yt directly.
d = 1: The series has a trend and is non-stationary. Subtract each value from the previous one (ΔYt = Yt - Yt-1) — the differenced series is now stationary. This is the most common case for economic data (GDP, sales, prices).
d = 2: Even the differenced series is non-stationary. Difference it again. Rare in practice — most economic series become stationary after one difference.

In our example, Sales (Y) had a clear upward trend → non-stationary → we differenced once → ΔY became stationary → so d = 1.

Complete Spreadsheet

Here is the full spreadsheet after estimation (LINEST output in H3:I3):

RowB(t)C(Yt)D(ΔYt)E(ΔYt-1)F(Fitted)G(εt)
20100
311077
42115877.2+0.8
53122786.3+0.7
64130877.2+0.8
75136686.3-0.3
86144868.1-0.1
97150686.3-0.3
108158868.1-0.1
119164686.3-0.3
1210172868.1-0.1
1311178686.3-0.3
1412186868.1-0.1
1513194886.3
1614200686.3

Forecasting: Steps 8-9


Forecast ΔY_{13} (Cell D15):
  = I$3 + H$3*D14        → 13.6 + (-0.91)*8 = 13.6 - 7.3 = 6.3

Forecast Y_{13} (Cell C15):
  = C14 + D15            → 186 + 6.3 ≈ 192.3 → rounds to ~192

Forecast ΔY_{14} (Cell D16):
  = I$3 + H$3*D15        → 13.6 + (-0.91)*6.3 = 13.6 - 5.7 = 7.9

Forecast Y_{14} (Cell C16):
  = C15 + D16            → 192.3 + 7.9 ≈ 200.2 → rounds to ~200
            
Final ARIMA(1,1,0) Results
ARIMA(1,1,0) Model Estimates (LINEST on differenced data):
  d (differencing) = 1
  φ₁ (AR coefficient) ≈ -0.91
  c (constant) ≈ 13.6
  SSE ≈ 3.0
  Long-run growth = c/(1-φ₁) = 7.1 units/quarter

Forecast:
  2026-Q2 (t=13): Y ≈ 192  (growth ΔY = 6)
  2026-Q3 (t=14): Y ≈ 200  (growth ΔY = 8)
  The alternating pattern (6, 8, 6, 8...) continues in the forecast.

6. Excel vs. Python — When to Use Which

Verification: Excel vs Python on the Same Data


# Run this in Python to verify our Excel results
import pandas as pd; import numpy as np
from statsmodels.tsa.arima.model import ARIMA

Y = [100,107,115,122,130,136,144,150,158,164,172,178,186]
model = ARIMA(Y, order=(1,1,0)).fit()
print(f"φ₁ = {model.params['ar.L1']:.3f}")
print(f"c  = {model.params.get('const', model.params.get('intercept', 0)):.3f}")
print(f"AIC = {model.aic:.2f}")
fc = model.forecast(steps=2)
print(f"Forecast t=13: {fc[0]:.1f}")
print(f"Forecast t=14: {fc[1]:.1f}")
            
Python (statsmodels) Verification
φ₁ ≈ -0.89    (Excel LINEST: -0.91  ✓ close match — OLS vs MLE)
c  ≈ 13.49    (Excel LINEST: 13.60   ✓ close match)
AIC = 51.2    (Excel approximate: — different computation)
Forecast t=13: 192.4
Forecast t=14: 200.9

Minor differences are expected:
- Excel LINEST uses OLS; statsmodels uses MLE (Maximum Likelihood)
- OLS and MLE give very similar results for AR models
- The Excel approach produces valid, interpretable estimates

Side-by-Side Comparison

CriterionExcelPython (statsmodels)
Speed (small data)Instant — LINEST or Solver in <1sInstant
Speed (large data)Painfully slow or impossibleHandles thousands of observations easily
DiagnosticsManual — AIC, residuals computed by youAutomatic — Ljung-Box, AIC/BIC, SEs, p-values
Confidence IntervalsDifficult — requires matrix algebraAutomatic — reported in model summary
ARIMA order selectionManual trial-and-errorauto_arima() searches automatically
TransparencyEvery cell visible — ideal for teachingBlack box — MLE runs inside compiled code
SARIMAExtremely tedious (many parameters)Trivial — just set seasonal_order
ReproducibilityPoor — Solver settings not saved with fileExcellent — script produces identical results every run
Best forTeaching, verifying small models, building intuitionResearch, publication, real-world forecasting
📚
Key Insight: The Excel manual estimates (φ₁ ≈ -0.91, c ≈ 13.6) and Python's MLE estimates (φ₁ ≈ -0.89, c ≈ 13.5) are nearly identical. The manual spreadsheet approach produces valid results — and more importantly, shows why the Python output looks the way it does. When you see ar.L1 = -0.89 in a statsmodels summary, you now know exactly what computation produced that number.

When to Use Each Approach

Key Takeaways

1

Stationarity testing in Excel is manual but transparent: split the data into halves, compare means, compute autocorrelation with =CORREL(), and difference the series until stable. The logic is identical to ADF/KPSS — just computed by hand.

2

AR models are linear — Excel's =LINEST() estimates them directly. MA models are non-linear — you need Solver because the residuals are part of the estimation. This is the fundamental reason ARIMA estimation requires iterative algorithms.

3

Excel and Python produce nearly identical results on small data. Your φ₁ ≈ -0.91 from LINEST matches Python's -0.89 from MLE. The Excel approach is not a "toy" — it is a valid estimation method. The difference is automation, not mathematics.

4

Learning ARIMA in Excel before Python builds lasting intuition. When you see ar.L1 = -0.89 in statsmodels output, you know exactly what that number means and how it was computed — because you built it yourself, cell by cell.

5

The 9-step workflow (plot → difference → lag → estimate → fitted → SSE → diagnose → forecast → recover levels) is universal. Whether you use Excel, Python, R, or STATA, these are the same steps. Master them in Excel, and every other tool becomes easier.