Hat Matrix Trace - Quant Trader Interview Question
Difficulty: Medium
Category: Linear Algebra & Machine Learning
Practice quant interview questions from top firms including Jane Street, Citadel, Two Sigma, DE Shaw, and other leading quantitative finance companies.
Topics: linear-algebra, regression, statistics, ols
Problem Description
Consider a standard Ordinary Least Squares (OLS) linear regression model: $Y = X \beta + \epsilon$, where:
$Y$ is an $N \times 1$ vector of the dependent variable.
$X$ is an $N \times p$ matrix of independent variables (including a constant if one is used).
$\beta$ is a $p \times 1$ vector of coefficients.
$\epsilon$ is an $N \times 1$ vector of error terms.
The 'hat matrix' $H$ is defined as $H = X(X^T X)^{-1} X^T$. What is the trace of $H$, i.e., $tr(H)$?
Practice this medium trader interview question on MyntBit - the all-in-one quant learning platform with 200+ quant interview questions for Jane Street, Citadel, Two Sigma, and other top quantitative finance firms.