FunctionRacerProblemsRace

Line Through Zero

BeginnerstatsmodelsPython

Some relationships must pass through the origin: no hours, no pay. Fit y = slope * x with no intercept by ordinary least squares and return the slope.

Example 1

x [1,2,3]
y [2,4,6]
returns 2.0

y is exactly twice x.

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