Range for the Slope
Fit an ordinary least squares line to the points (x[i], y[i]) and return [low, high]: the confidence interval of its slope at confidence level level (such as 0.95).
Example 1
x [0,1,2,3]
y [0,1,0,1]
level 0.95
returns [-1.0169739689035808,1.4169739689035807]
The interval runs from about -1.02 to 1.42 and contains 0.
Constraints
4 <= len(x) <= 40levelis 0.9, 0.95 or 0.99- 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
- Two CausesEasy
- Better of Two ModelsMedium
- Chance of YesMedium
- Does One Change the OtherMedium
- Model for CountsMedium
- Odds of YesMedium
- Pattern in the LeftoversMedium
- Point That Pulls HardestMedium