k-Nearest-Neighbour (Analogue) Time Series Forecasting
Forecasts by finding the past moments whose recent values look most like the latest ones and averaging what came next. The number of lags and neighbours can be chosen on a hold-out; forecasts several steps ahead either iterate the one-step rule or average the neighbours' whole future paths.
최근 값과 가장 비슷했던 과거 시점들을 찾아 그다음에 일어난 값을 평균해 예측합니다. 시차 수와 이웃 수를 보류 구간에서 고를 수 있고, 여러 단계 예측은 한 단계 규칙을 반복하거나 이웃들의 미래 경로 전체를 평균합니다.
Which past weeks looked like the last four weeks of sales, and what happened after them?
최근 4주 매출과 닮은 과거 주는 언제였고 그 뒤에 무엇이 일어났는지 알고 싶습니다.
The chosen lags and k, hold-out errors against the naive forecast for every setting tried, and the forecast path.
When to use k-Nearest-Neighbour (Analogue) Time Series Forecasting
- The dynamics are nonlinear or repeat in patterns
- A transparent, assumption-light forecaster is wanted
- Long history is available
When to use something else
- The goal is to measure nonlinear predictability by embedding dimension: use Simplex Projection (Empirical Dynamic Modelling)
- Short series: use ARIMA Model
Assumptions and requirements
- Equally spaced observations
- The future resembles past analogues
What the analysis reports
- Hold-out RMSE and MAE by lags and k
- Naive benchmark
- Forecast path
How to report it
kNN forecasting with [value] lags and k = [value] gave a one-step hold-out RMSE of [value] (naive [value]).
Related methods
How this method is validated
이 방법의 검증 근거
- R cross-check. 6 reported values agree with R (caret::knnreg) within a tolerance of 1e-10; the largest observed difference is 1e-15.
R 교차 검증. R(caret::knnreg) 대조: 보고 값 6개가 허용오차 1e-10 안에서 일치합니다(관측된 최대 차이 1e-15).
- Supporting tables vs R. Descriptive statistics and assumption checks shown with the results (19 values) agree with R (psych::describe, stats::quantile, stats::t.test, stats::shapiro.test) within 1e-6. This covers the supporting tables, not the main estimates.
보조 표 R 대조. R(psych::describe, stats::quantile, stats::t.test, stats::shapiro.test) 대조: 결과와 함께 나오는 기술통계·가정 점검 값 19개가 1e-6 안에서 일치합니다. 본 추정치가 아니라 보조 표에 대한 대조입니다.
- Independent computation. 2 reference tests compare the results with scikit-learn, statsmodels and direct computations (formulas, enumeration or simulation).
독립 계산. scikit-learn·statsmodels·직접 계산(식·열거·모의실험) 대조 참조 시험 2건 통과.
Tolerances are relative differences (absolute differences for values near zero). R comparisons and reference tests are re-run before each release of the analysis engine.
허용오차는 상대 차이입니다(0 근처 값은 절대 차이). R 대조와 참조 시험은 분석 엔진을 배포할 때마다 다시 돌립니다.
Run k-Nearest-Neighbour (Analogue) Time Series Forecasting on Quorant
- Data you need
- a table (CSV or Excel) with a time variable and an outcome variable
- Price
- 250 credits for one analysis up to 10,000 rows (complexity level 2); larger or wider data costs more. Optional methodologist review: 1200 credits.
- Checking
- Results cross-checked against R
- Before you pay
- A free pre-analysis diagnosis checks your data and gives an exact quote; nothing is deducted until you approve it.