FunctionRacerProblemsRace

Uneven Spread

MediumstatsmodelsPython

Least squares assumes the scatter around the line is equally wide everywhere. Fit an ordinary least squares line to the points (x[i], y[i]) and return the p-value of the Breusch-Pagan test for uneven scatter (use the first, Lagrange multiplier, version of the p-value).

Example 1

x [1,2,3,4,5,6,7,8]
y [1.1,1.9,3.2,3.7,5.9,4.8,9.1,5.5]
returns 0.028520357309904452

The misses grow as x grows, and the small p-value says so.

Constraints

Race itor take your time

Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.

More statsmodels problems