The forecast that barely beat yesterday
A regression that forecasts the next day's opening price, tested against the simplest possible rival: tomorrow equals today.
The chart
01 / Symptom
Can a simple regression on recent prices forecast tomorrow's opening price of a stock or index fund?
02 / Tests
Built a regression in Python with pandas, scikit-learn and yfinance, then scored a "tomorrow equals today" forecast the same way.
03 / Diagnosis
R² of 0.989 against 0.975 for the naive forecast. Prices are so autocorrelated that a high R² proves little.
04 / Prescription
Test every forecast against the naive baseline first, and judge it on the improvement, not the headline score.
05 / Outcome
A lesson about baselines, not a trading model.
How the tests ran
- Downloaded daily prices with yfinance and built lagged price features in pandas.
- Fitted a linear regression in scikit-learn to forecast the next day's open.
- Scored a naive forecast (tomorrow equals today) on the same test data.
Tools
- Python
- pandas
- scikit-learn
- yfinance
Findings
0.989
R² of the regression on price levels
0.975
R² of the naive "tomorrow equals today" forecast
Limits
- R² on price levels flatters any forecast. Returns, or error against the naive forecast, are the fairer test.