توضیح 1
The live starter code is self-contained and uses only runner-compatible functions.
Loading
درس 12 از 22
Follow an auditable specify–estimate–diagnose–forecast–evaluate loop.
Motivation
ARIMA is useful only when preprocessing, candidate comparison, residual diagnostics, and out-of-sample scoring use information available at the forecast origin.
Why this matters
Follow an auditable specify–estimate–diagnose–forecast–evaluate loop.
Packages and data
Base stats; forecast 9.0.2 and fable 0.5.0 are optional extensions.
توضیح 1
The live starter code is self-contained and uses only runner-compatible functions.
توضیح 2
Book-only outputs are labelled when the separate source dataset or advanced package was not supplied.
توضیح 3
R code, paths, function names, and formulas remain left-to-right in every locale.
اصطلاحات
Transforms levels to changes to address stochastic trend.
Avoid unnecessary differencing
One-step error after conditioning on the past.
Residuals approximate innovations
Later observations reserved from fitting.
Preserve time order
نمادگذاری و فرمولها
phi(B)(1-B)^d yt = c + theta(B) error_t
ARIMA combines differencing with autoregressive and moving-average dependence.
مثال حلشده
سناریو
Does a compact ARIMA forecast improve on the training endpoint for a simulated series?
بررسی با R
set.seed(1212)
y <- cumsum(arima.sim(list(ar=.45), n=96))
train <- head(y,-12); test <- tail(y,12)
fit <- arima(train, order=c(1,1,1), method='ML')
fc <- predict(fit,n.ahead=12)
print(sqrt(mean((test-fc$pred)^2)))
print(Box.test(residuals(fit),lag=12,type='Ljung-Box',fitdf=2))A small p-value signals residual dependence in that book specification rather than a result to hide. Limitation: One holdout origin is uncertain; rolling origins and naive benchmarks provide stronger evidence.
Visual
Intervals widen with horizon in a typical model-based forecast.
ارتباط با R
Run the self-contained starter code in the protected STATLAB R runner. The code prints an auditable result and avoids network or unrestricted file access.
Live R Lab
Run a self-contained example, verify its output, and explain one limitation for arima estimation, diagnostics, and forecasting.
Ready to run
Common mistake
A 95% prediction interval is conditional on the model, not a 95% guarantee.
STATLAB Tip
Always include a transparent naive benchmark.
تمرین هدایتشده
سناریو
Compare ARIMA(0,1,1) and ARIMA(2,1,0) using AIC, residual ACF, and holdout error.
Compare your result with the definition, units, and model assumptions—not only with a target number.
Exercises
Complete these without looking at the selected solutions. More than one defensible program may exist.
توضیح 1
Calculate MAE.
توضیح 2
Construct 80% intervals.
توضیح 3
Design a rolling-origin table.
Selected solutions
These are compact solution routes. Confirm dimensions, units, and any changed modelling choices.
توضیح 1
mean(abs(test-fc$pred))
توضیح 2
fc$pred + c(-1,1)*qnorm(.90)*fc$se for each horizon
توضیح 3
Store origin, horizon, actual, forecast, and error without future leakage.
Chapter summary
Follow an auditable specify–estimate–diagnose–forecast–evaluate loop.
توضیح 1
ARIMA combines differencing and lag dependence.
توضیح 2
Information criteria only compare candidates.
توضیح 3
Forecast uncertainty is model-conditional.
توضیح 4
Time-ordered evaluation is essential.
اصطلاحات
fit model
Use in ARIMA Estimation, Diagnostics, and Forecasting.
compare fit
Use in ARIMA Estimation, Diagnostics, and Forecasting.
forecast
Use in ARIMA Estimation, Diagnostics, and Forecasting.
diagnose residuals
Use in ARIMA Estimation, Diagnostics, and Forecasting.
References and provenance
Safavi (2026), Chapter 12. Student notes: Mohammad Safavi, Ph.D., STATLAB Academy, Version 1.0.
منبع
The authoritative 125-page English PDF accompanies this native lesson.
دریافتبازاندیشی
Name the assumption, evidence you would seek, and how the recommendation might change.
ارزیابی پایانی