Linear regression interview questions and answers

Linear regression interview questions check whether you can fit a model, read its coefficients correctly and say when it cannot be trusted. Expect ordinary least squares and its assumptions, what a coefficient means holding other variables fixed, R squared versus adjusted R squared, residual plots, multicollinearity, ridge and lasso, and a scenario where the data breaks an assumption. Strong answers move from the math to what the numbers mean for a decision.

By Published 8 min read

Where linear regression shows up in interviews

Regression is the first model most interviewers reach for, because it reveals how a candidate thinks about data. It appears in data scientist and analyst loops, in quant and economics-flavored roles, in marketing analytics (pricing, attribution, mix models) and as the warm-up in machine learning screens. The questions are rarely about running fit(). They are about what the output means, which assumption a dataset violates, and what you would do about it.

  1. Concept screenQuick questions: what OLS minimizes, what R squared measures, what a p-value on a coefficient tells you. One correct sentence and one example per answer.
  2. Interpretation roundYou are shown a regression table and asked to explain each coefficient, its interval and whether the model can support a business claim.
  3. Coding or derivationFit OLS with NumPy, derive the normal equations, or compute R squared by hand. Some loops ask for gradient descent instead of the closed form.
  4. Modeling scenarioA messy case such as forecasting sales from ad spend or pricing a house. You choose features, transformations and checks, and say what could mislead you.

Linear regression fundamentals questions

Fundamentals for freshers and every first screen
QuestionWhat it testsWhat a strong answer shows
What does ordinary least squares minimize?The objectiveThe sum of squared residuals, the gaps between observed values and the fitted line. Squaring makes the loss smooth and penalizes large misses more than small ones.
Write the closed-form OLS solution.Linear algebraBeta equals (XᵀX)⁻¹Xᵀy, which comes from setting the gradient of the squared loss to zero. In practice you solve it with a QR or least squares routine rather than an explicit inverse, for numerical stability.
What are the classic assumptions of linear regression?AssumptionsA linear relationship in the parameters, independent errors, constant error variance, no perfect collinearity, and errors with zero mean given X. Normal errors matter for exact small-sample tests, less for large samples.
Which assumptions matter for prediction and which for inference?JudgementA model can predict well while violating several assumptions. Independence, constant variance and exogeneity matter most when you report standard errors, p-values or causal effects.
What does R squared measure?Fit metricsThe share of variance in y explained by the model relative to predicting the mean. It never falls when you add a variable, so it rewards clutter.
Why use adjusted R squared?Model comparisonIt penalizes extra predictors by the degrees of freedom they use, so adding a useless variable can lower it. For prediction, cross-validated error is a better comparison.
What is a residual and why plot residuals?DiagnosticsThe observed value minus the fitted value. Plots against fitted values or each predictor expose curvature, fanning variance and outliers that summary numbers hide.
How is simple linear regression related to correlation?Statistics linkIn simple regression the slope equals the correlation times the ratio of the standard deviations of y and x, and R squared equals the squared correlation.
Why might you use gradient descent instead of the closed form?OptimizationWith very many features or rows, forming and solving XᵀX is expensive, and gradient methods stream through data in batches. For small problems the closed form is exact and fast.
What does the intercept mean?InterpretationThe predicted y when every predictor is zero. It is often meaningless (a house with zero square feet) unless you center the predictors.
Fundamentals for freshers and every first screen. Scroll sideways on a small screen.
import numpy as np
from sklearn.linear_model import LinearRegression

rng = np.random.default_rng(0)
n = 200
X = rng.normal(size=(n, 2))
y = 3.0 + 2.0 * X[:, 0] - 1.5 * X[:, 1] + rng.normal(scale=0.5, size=n)

# OLS by least squares: add a column of ones for the intercept
A = np.column_stack([np.ones(n), X])
beta, *_ = np.linalg.lstsq(A, y, rcond=None)
print(beta.round(2))  # [ 3.    1.97 -1.44], near the true 3, 2, -1.5

# R squared and adjusted R squared by hand
resid = y - A @ beta
r2 = 1 - (resid @ resid) / ((y - y.mean()) @ (y - y.mean()))
p = X.shape[1]
adj_r2 = 1 - (1 - r2) * (n - 1) / (n - p - 1)
print(round(r2, 3), round(adj_r2, 3))  # 0.958 0.957

# Same coefficients from scikit-learn
model = LinearRegression().fit(X, y)
print(round(model.intercept_, 2), model.coef_.round(2))  # 3.0 [ 1.97 -1.44]
OLS with NumPy least squares, R squared and adjusted R squared by hand, checked against scikit-learn.

Interpreting coefficients

Interpretation questions sink more candidates than math does. Practise saying each answer in the units of the problem: "each extra 100 square feet adds about this much to the predicted price, holding bedrooms and location fixed".

  • What does a coefficient mean in a multiple regression? The expected change in y for a one-unit change in that predictor while the other predictors stay fixed. It is a partial effect, so it can differ in size and even sign from the simple correlation.
  • How do you interpret a coefficient when y is logged? Roughly a 100 times beta percent change in y per unit of x for small beta; exactly, exp(beta) minus one. When both sides are logged, beta is an elasticity: a 1 percent change in x goes with a beta percent change in y.
  • How do you include a categorical variable such as region? One-hot encode it and drop one level as the baseline. Each coefficient is then the difference from that baseline. Keeping every level plus an intercept creates perfect collinearity (the dummy variable trap).
  • What does an interaction term do? It lets the effect of one variable depend on another, for example a discount that works better on weekends. Once you add one, the main effects describe the case where the other variable is zero, so centering helps.
  • A coefficient is not significant. Does that mean the variable has no effect? No. It means the data cannot distinguish the effect from zero at that sample size and noise level. Look at the confidence interval: a wide interval around zero says little either way.
  • Why would a coefficient's sign flip when you add another variable? The new variable was a confounder or is correlated with the first one, so the first coefficient was absorbing its effect. This is Simpson's paradox territory and worth naming.
  • How do you compare the importance of predictors measured in different units? Standardize the predictors and compare coefficients, or compare the drop in cross-validated fit when each is removed. Raw coefficients in different units are not comparable.

Diagnostics and assumption questions

Intermediate questions on when the model goes wrong
QuestionWhat it testsWhat a strong answer shows
What is heteroscedasticity and how do you spot it?VarianceError spread that changes with the fitted value or a predictor, seen as a funnel in the residual plot. Coefficients stay unbiased, but the usual standard errors are wrong. Use robust (sandwich) standard errors, transform y, or use weighted least squares.
What is multicollinearity and why does it matter?CollinearityPredictors that are strongly correlated with each other. Predictions can still be fine, but individual coefficients become unstable with large standard errors. Check variance inflation factors and the correlation matrix.
What VIF worries you?Rules of thumbCommon rules of thumb flag values above 5 or 10, but they are conventions, not tests. Say what you would do: drop or combine variables, collect more data, or use ridge regression.
Outlier, leverage and influence: what is the difference?Influential pointsAn outlier has a large residual. A high-leverage point has unusual X values. An influential point changes the fit a lot when removed, which Cook's distance measures. A point can have high leverage and still sit on the line.
The residuals curve in a U shape. What do you do?NonlinearityThe relationship is not linear in that predictor. Add a polynomial or spline term, transform the variable, or move to a model that captures the shape.
Why do correlated errors matter in time-ordered data?IndependenceAutocorrelated residuals make standard errors too small, so effects look more certain than they are. Check residuals over time and use methods built for serial correlation.
Do the errors need to be normal?NormalityNot for unbiased coefficients. Normality supports exact t and F tests in small samples; with large samples the central limit theorem covers most inference. A Q-Q plot shows heavy tails worth investigating.
What is endogeneity?ExogeneityWhen a predictor is correlated with the error term, from omitted variables, reverse causality or measurement error. Coefficients are then biased however much data you collect.
Intermediate questions on when the model goes wrong. Scroll sideways on a small screen.
import numpy as np

def vif(X):
    """Variance inflation factor for each column of X (no intercept column)."""
    out = []
    for j in range(X.shape[1]):
        others = np.delete(X, j, axis=1)
        A = np.column_stack([np.ones(len(X)), others])
        beta, *_ = np.linalg.lstsq(A, X[:, j], rcond=None)
        resid = X[:, j] - A @ beta
        r2 = 1 - resid.var() / X[:, j].var()
        out.append(1 / (1 - r2))
    return np.array(out)

rng = np.random.default_rng(1)
a = rng.normal(size=500)
b = a + rng.normal(scale=0.1, size=500)   # almost a copy of a
c = rng.normal(size=500)                  # unrelated
print(vif(np.column_stack([a, b, c])).round(1))  # [76.5 76.6  1. ]
Variance inflation factors by hand: regress each predictor on the others and use 1 / (1 - R squared).

Regularization and model choice questions

  • What do ridge and lasso add to OLS? A penalty on coefficient size: squared for ridge, absolute for lasso. Ridge shrinks correlated coefficients toward each other; lasso can set some exactly to zero and so selects features. Both need standardized predictors.
  • How do you choose the penalty strength? By cross-validation over a grid of values, picking the best score or the simplest model within one standard error of it.
  • Why does regularization trade bias for variance? Shrinking coefficients makes the fit less sensitive to the particular sample, at the cost of pulling true effects toward zero. With many noisy features the variance saved is usually worth more.
  • When would you not use linear regression? When the outcome is a class or a count (use logistic or Poisson regression), when relationships are strongly nonlinear with many interactions (trees or boosting), or when observations are clearly dependent (mixed or time series models).
  • Linear regression versus logistic regression? Linear regression predicts a continuous value with squared error. Logistic regression models the log-odds of a binary outcome and is fitted by maximum likelihood; its coefficients are changes in log-odds.
  • Can linear regression fit a curve? Yes. Linear means linear in the coefficients, so polynomial terms, splines and log transforms of x are all still linear regression.
  • How do you check that a model generalizes? Hold out data or use k-fold cross-validation and compare error to a simple baseline. In-sample R squared alone cannot tell you.

Senior and scenario questions

Senior rounds test whether you know what a regression can and cannot prove. Many of these scenarios also lead into experiments, covered in A/B testing interview questions, or into data ordered in time, covered in time series interview questions.

Scenario questions for experienced candidates
QuestionWhat it testsWhat a strong answer shows
Marketing says the regression proves ad spend drives sales. Do you agree?CausalitySpend is often set in response to expected demand, so the coefficient can reflect timing rather than effect. Ask how spend was allocated, look for confounders such as seasonality, and propose a holdout test or geographic experiment.
Your model has an R squared of 0.95 on house prices. Are you happy?SkepticismCheck for leakage (a feature derived from the sale price), duplicates across train and test, and performance on a time-based holdout. A high R squared can still hide large errors on the expensive homes that matter most.
Two strongly correlated features both look insignificant, but dropping both hurts fit. Explain.CollinearityTogether they carry signal, but the model cannot split credit between them, so each individual test is weak. An F-test on the pair shows the joint effect.
How would you estimate price elasticity from historical sales?Applied econometricsA log-log regression of quantity on price with controls for season, promotions and competitor prices, then a warning that price changes may be endogenous. A planned price test gives cleaner evidence.
The residual variance grows with revenue. What changes in your report?Robust inferenceReport heteroscedasticity-robust standard errors, consider modeling log revenue, and present prediction intervals that widen for large accounts.
You have 50 rows and 40 features. What do you do?High dimensionOLS will overfit or fail to be unique. Reduce features with domain knowledge, use ridge or lasso with cross-validation, and be honest that the sample cannot support many claims.
Scenario questions for experienced candidates. Scroll sideways on a small screen.

Fictional example

"Explain this coefficient to the head of sales"
Interviewer
Your model of monthly store revenue has a coefficient of 0.8 on staff hours, both in thousands. The head of sales wants to add hours everywhere. What do you say?
Candidate
I would say that stores with more staff hours have earned more revenue, about 800 per extra thousand hours, but the model does not show that adding hours causes that gain. Busy stores get more hours because they are busy. Before rolling it out, I would check whether the coefficient holds when I control for foot traffic and store size, and I would suggest a test: add hours in a random set of comparable stores for a quarter and compare them with the rest. If the gain holds there, the rollout case is much stronger.

A ten-day linear regression practice plan

  • Days 1 and 2: derive the normal equations on paper and explain each OLS assumption in one sentence with an example of it failing.
  • Days 3 and 4: fit OLS three ways (NumPy least squares, scikit-learn, gradient descent you write) and confirm the coefficients match.
  • Days 5 and 6: read regression tables aloud. For each coefficient, state the effect in units, its interval, and whether a causal reading is safe.
  • Day 7: break assumptions on purpose with simulated data (a curve, a funnel, a near-duplicate feature) and practise diagnosing each from plots.
  • Days 8 and 9: run ridge and lasso with cross-validation on a dataset with many features and explain the path of coefficients as the penalty grows.
  • Day 10: two scenario questions out loud, one causal claim to challenge and one prediction task to design end to end.

Regression answers usually fail in the explanation: the math is right, but the candidate forgets to say "holding the other variables fixed" or claims cause from a correlation. Natively, an AI interview assistant for Mac and Windows, transcribes your practice sessions on your computer so you can read back exactly how you described each coefficient. While you practise it can draft answer suggestions, read a regression table or a residual plot from a screenshot, and help with the NumPy code. With Pro or the free trial it can also use your résumé and the job description you add. The transcript and notes stay available for review.

Questions people ask

What linear regression questions are asked in interviews?

What OLS minimizes and its closed form, the model's assumptions, how to interpret coefficients and dummy variables, R squared versus adjusted R squared, residual diagnostics, multicollinearity and VIF, ridge and lasso, and a scenario about a causal claim.

What are the assumptions of linear regression?

Linearity in the parameters, independent errors, constant error variance, no perfect collinearity and errors with zero mean given the predictors. Normal errors help exact small-sample tests but are not needed for unbiased coefficients.

How do I interpret a regression coefficient in an interview?

State the expected change in the outcome for a one-unit change in that predictor, in real units, while the other predictors are held fixed. Then add its confidence interval and whether the data supports a causal reading.

Is linear regression still asked in machine learning interviews?

Yes, often as the warm-up. Interviewers use it to check the bias-variance trade-off, regularization, gradient descent and how you validate a model before moving to more complex ones.

Where to go next

Practice with the same assistant you would use on a call: it listens, transcribes and suggests answers from your own resume and the job description.

Facts on this page were last checked on . Product details come from the Natively app itself; if something here is out of date, tell us at hello@heynatively.com.

Keep reading

Put it on your own machine.

A live-conversation assistant that runs locally. Your conversations stay on your machine.

macOS 12+ · Windows 10/11

© 2026 Natively AI Private Limited

Source-available under the Natively Personal Use Source License v1.0 · IP geolocation by DB-IP