Linear Trend Forecast

easy
Unit 7 · Economics0/3 to milestone

Fit a straight line y = a + b t to a series (with t = 0, 1, ..., n-1) by least squares and forecast h steps ahead.

Implement trend_forecast(y, h) returning (a, b, forecast) where forecast is an array of the next h values (t = n, ..., n + h - 1).

#forecasting#time-series#regression2 visible + 1 hidden tests
solution.py · Python 3.13
Loading editor…
Run your code to see results. ⌘↵ to run · ⌘⇧↵ to submit
Linear Trend Forecast · TechGradify