KatInterview

Regression Invariance Under Feature Transformations

Statistics & ExperimentsModel answer
MediumModel answerStatistics & Experimentslinear-regressionridge-regressionlasso

Last updated

Show mathematically how ordinary least squares predictions behave when features are linearly transformed, and contrast with regularized methods.

Consider two regression setups. In the first, you regress response y on features X₁ and X₂. In the second, you apply an invertible linear transformation to create new features Z = XT, where T is a 2×2 invertible matrix. For concreteness, take T = [[1, 1], [-1, 1]], so the transformed features are Z₁ = X₁ - X₂ and Z₂ = X₁ + X₂.

Part (a): Demonstrate that ordinary least squares produces identical predictions regardless of whether you fit on the original features X or the transformed features Z. Derive the relationship between the coefficient vectors in the two parameterizations.

Part (b): Analyze whether this invariance extends to ridge regression (with penalty λ||β||₂²) and lasso regression (with penalty λ||β||₁). State precisely under what conditions each method's predictions remain unchanged when features are transformed. Consider both the given transformation T and the general case.

Part (c): For ridge regression, write out the solution formulas and determine when predictions stay the same across parameterizations. For lasso, construct a specific numerical example demonstrating that predictions can differ between the original and transformed features.

Hints

Hint 1

OLS fits a projection onto the column space of the design matrix. How does an invertible transformation affect this space?

Hint 2

Regularization penalties apply to the coefficient vector. When you substitute the transformed coefficients, what penalty does this induce in the original parameterization?

Hint 3

The ℓ₂ norm is preserved by orthogonal matrices, while the ℓ₁ norm is preserved only by signed permutations. What type of matrix is the given T?