FunctionRacerProblemsRace

Fair R Squared

EasystatsmodelsPython

Each row of X holds the predictors of one observation, and y holds the outcomes. Fit ordinary least squares with an intercept and return the adjusted R squared, which, unlike plain R squared, does not rise just because predictors were added.

Example 1

X [[1,5],[2,3],[3,4],[4,1],[5,2],[6,6]]
y [8,16,19,30,33,30]
returns 0.9987705980705096

About 0.86 of the variation is explained once the two predictors are paid for.

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