How Sure Is the Slope
Fit an ordinary least squares line to the points (x[i], y[i]) and return the standard error of its slope: how much the slope would wobble from sample to sample.
Example 1
x [0,1,2,3]
y [0,1,0,1]
returns 0.28284271247461906
The slope is 0.2 with a standard error of about 0.28: the data cannot tell it from 0.
Constraints
4 <= 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
- Line Through ZeroBeginner
- Line Through the DataBeginner
- Reading Off the LineBeginner
- Room for the InterceptBeginner
- Slope From a TableBeginner
- What the Line MissesBeginner
- Echo of YesterdayEasy
- Fair R SquaredEasy