Time Series • Introduction to Autoregressive Models and Forecasting
Time Series / P4.03 Statistical Inference

P4.03 Statistical Inference

Practical 4 Introduction to Autoregressive Models and Forecasting

Using the 24-month sales trend from P4.01, report coefficient standard errors, a 95% confidence interval for the slope, and the t-test of H0: slope = 0. Then warn about autocorrelation.

Practical / Solution

P4.03 Statistical Inference in Regression

Problem Statement

Using the 24-month sales trend from P4.01, report coefficient standard errors, a 95% confidence interval for the slope, and the t-test of H0: slope = 0. Then warn about autocorrelation.

Learning Outcomes

  • Read standard errors and confidence intervals.
  • Interpret a slope t-test in words.
  • State that i.i.d. error inference can fail for time series.

Theory

Under classical OLS assumptions, each coefficient has a standard error. A 95% confidence interval is estimate ± t-critical × SE. The t-statistic tests whether a coefficient could be zero. If residuals are autocorrelated, those SEs and p-values are often too optimistic. Report the numbers, then treat them as tentative until residual ACF is checked.

Dataset / Data Source

Same constructed 24-month sales series as P4.01.

Analysis / Program

import numpy as np import pandas as pd import statsmodels.api as sm t = np.arange(24) sales = 80 + 1.5 * t + np.array([ 2, -1, 3, 0, -2, 4, 1, -3, 2, 0, -1, 3, 1, -2, 2, 0, 1, -1, 3, -2, 0, 2, -1, 1 ]) X = sm.add_constant(t) fit = sm.OLS(sales, X).fit() print(fit.summary().tables[1]) print("Slope 95% CI:", fit.conf_int()[1]) print("Slope t-stat:", round(fit.tvalues[1], 3)) print("Slope p-value:", round(fit.pvalues[1], 4))

Expected Output

A coefficient table with std err, t, P>|t|, and a printed 95% interval for the slope. For this constructed upward series the slope interval should lie above zero, but do not memorise a fabricated p-value.

Result / Interpretation

If the slope interval excludes zero, the linear time term is statistically detectable under OLS assumptions. Those assumptions include uncorrelated errors. A later residual ACF may show that the reported p-value should not be treated as exact.

Note

Standard errors and p-values assume the model errors behave as stated. Autocorrelation can invalidate ordinary OLS inference.