What happens to the OLS estimator if the number of features is greater than the number of observations?

Quick Overview

Asks what happens to ordinary least squares when a dataset has more features than observations. Tests understanding of rank deficiency, identifiability, overfitting, what the situation does to statistical inference, and how regularization or dimension reduction gives a usable estimate.

What happens to the OLS estimator if the number of features is greater than the number of observations?

Role: Data Scientist

Category: Machine Learning

Difficulty: medium

Interview Round: Other

What happens to the OLS estimator if the number of features is greater than the number of observations? ```hint Look at the normal equations OLS solves $X^\top X \beta = X^\top y$. Think about the rank of $X^\top X$ when $X$ has more columns than rows, and what that means for how many $\beta$ satisfy the equations. ``` ### What a Strong Answer Covers - Why $X^\top X$ is singular when $p > n$ and what that does to the closed-form estimator - Non-uniqueness of the solution and the perfect fit on the training data - Consequences for predictions on new data and for inference (standard errors, tests, $R^2$) - Remedies such as ridge, lasso, dimensionality reduction or feature selection, and what each one changes ### Follow-up Questions - If you pass such data to a standard least-squares routine, which of the many solutions does it return? - Why does ridge regression always have a unique solution, even when $p > n$? - What goes wrong with OLS when $p$ is smaller than $n$ but close to it? - How many nonzero coefficients can lasso select when $p > n$, and how does elastic net change that?

Overview: Asks what happens to ordinary least squares when a dataset has more features than observations. Tests understanding of rank deficiency, identifiability, overfitting, what the situation does to statistical inference, and how regularization or dimension reduction gives a usable estimate.

PracHub logo
General
Nov 25, 2026
mediumData ScientistOtherMachine Learning
0
0

What happens to the OLS estimator if the number of features is greater than the number of observations?

What a Strong Answer Covers Guidance

  • Why X⊤XX^\top X is singular when p>np > n and what that does to the closed-form estimator
  • Non-uniqueness of the solution and the perfect fit on the training data
  • Consequences for predictions on new data and for inference (standard errors, tests, R2R^2 )
  • Remedies such as ridge, lasso, dimensionality reduction or feature selection, and what each one changes

Follow-up Questions Guidance

  • If you pass such data to a standard least-squares routine, which of the many solutions does it return?
  • Why does ridge regression always have a unique solution, even when p>np > n ?
  • What goes wrong with OLS when pp is smaller than nn but close to it?
  • How many nonzero coefficients can lasso select when p>np > n , and how does elastic net change that?