WalzoneInterview Prep
📞 Interviewing soon? Practice with a realistic AI mock phone interview — it calls you, then scores you. First 15 min FREE →

Wall Street Quant · Linear Algebra · question 64 of 155

Can you describe the Least Squares method?

📕 Buy this interview preparation book: 155 Wall Street Quant questions & answers — PDF + EPUB for $5

The Least Squares method, also known as Ordinary Least Squares (OLS), is a statistical technique used for estimating the parameters of a linear regression model. The goal is to find the best-fitting linear relationship between the dependent variable (usually denoted as y) and one or more independent variables (denoted as x). "Best-fitting" means that the linear relationship minimizes the sum of the squared differences (residuals) between the actual value of the dependent variable (y) and the predicted value ().

Given a dataset with n observations ((x1, y1), …, (xn, yn)) and a linear regression model defined as:


$$\hat{y_i} = \beta_0 + \beta_1 x_{i1} + \beta_2 x_{i2} + \cdots + \beta_k x_{ik}$$

where $\hat{y_i}$ is the predicted value, β0 is the intercept, β1, …, βk are the coefficients of the k independent variables xi1, …xik, and i = 1, …, n.

The least squares method aims to minimize the sum of the squared residuals:


$$RSS = \sum_{i=1}^{n} (y_i - \hat{y_i})^2$$

To solve for the coefficients β0, β1, …, βk, we need to find the partial derivatives of the RSS with respect to each β, and set them equal to zero:


$$\frac{\partial RSS}{\partial \beta_0} = 0, \frac{\partial RSS}{\partial \beta_1} = 0, \ldots, \frac{\partial RSS}{\partial \beta_k} = 0$$

This will result in a system of k + 1 normal equations. Solving this system provides the values of the regression coefficients that minimize the residual sum of squares.

In matrix notation, the linear regression model can be written as:


y = Xβ + ϵ

where y is a column vector of dependent variable values, X is a matrix with columns containing the independent variable values, β is a column vector containing the regression coefficients, and ϵ is a column vector containing the residuals.

Using least squares, the coefficients β can be estimated as:


$$\hat{\boldsymbol{\beta}} = (\mathbf{X}^\top \mathbf{X})^{-1} \mathbf{X}^\top \mathbf{y}$$

Here, X represents the transpose of matrix X, and (XX) − 1 is the inverse of matrix XX.

In summary, the Least Squares method is used to estimate the parameters of a linear regression model by minimizing the sum of the squared differences between the actual and predicted values of the dependent variable. The estimated parameters can be computed using normal equations or matrix algebra.

Reading is step one. Saying it out loud is the interview. Our AI interviewer calls your phone and runs a realistic Wall Street Quant interview — then scores it.
📞 Practice Wall Street Quant — free 15 min
📕 Buy this interview preparation book: 155 Wall Street Quant questions & answers — PDF + EPUB for $5

All 155 Wall Street Quant questions · All topics