Reading Off the Line
x and y are past measurements. Find their least squares line with statsmodels and use it to forecast: return its height at new_x.
Example 1
x [0,1,2]
y [1,3,5]
new_x 10.0
returns 21.0
On y = 1 + 2x, x = 10 gives 21.
Constraints
3 <= len(x) <= 40- The xs are not all equal
Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.
More statsmodels problems
- Room for the InterceptBeginner
- Slope From a TableBeginner
- What the Line MissesBeginner
- Echo of YesterdayEasy
- Fair R SquaredEasy
- Group GapsEasy
- Is the Share DifferentEasy
- Is the Slope RealEasy