FunctionRacerProblemsRace

Tangled Predictors

MediumstatsmodelsPython

Each row of X holds the predictors of one observation. Return the variance inflation factor of each column, in order: 1 when a predictor is unrelated to the others, large when the others nearly determine it. Compute them with an intercept in the model.

Example 1

X [[1,5],[2,3],[3,4],[4,1],[5,2],[6,6],[7,0],[8,7]]
returns [1.0051282051282049,1.005128205128205]

The two columns have little to do with each other, so both factors are close to 1.

Example 2

X [[1,2],[2,4.1],[3,5.9],[4,8.2],[5,9.8],[6,12.1],[7,14],[8,15.9]]
returns [1456.5845511481273,1456.5845511481273]

The second column is almost exactly twice the first, so both factors are huge.

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