本书暂未推出简体中文版。现有版本:English, Français。
Interviews I: Maths, Probability and Speed · 职业发展
18Regression
Regression as a quantitative researcher uses it: what a coefficient and its standard error really tell you, and what goes wrong on financial data, where regressors are noisy, observations overlap, volatility moves and the signal is tiny. Most questions ask for a number you can defend, and the later ones turn on an effect you could easily miss in your own work.
Question 18.1 ★ QR, QT, DS, Risk, Analyst • any • junior
You regress on and get a slope of 2. What values can the slope of the reverse regression, on , take? If the reverse slope turns out to be , what is the correlation of and ?
Answer
Answer to Question 18.1.
The reverse slope can be anything above 0 and up to . A reverse slope of means a correlation of .
With and , the product is
So , with in . The two slopes always have the same sign. If then , and the correlation is , positive because the slopes are.
Classic wrong answer. “.” That holds only with . Each regression minimises vertical errors along its own axis, so the two lines differ, and they coincide only when all the points lie on a line.
Why it matters. The choice of which variable to regress on which is not free when you set a hedge ratio. The two give different ratios, and the correct one depends on what you want to minimise.
Question 18.2 ★ QR, QT, DS, Risk • any • junior
You copy every row of a dataset, making it twice as long, and refit the same linear regression. What happens to the coefficients, their standard errors, the -statistics and ? Why does this matter when your observations overlap in time?
Answer
Answer to Question 18.2.
The coefficients and do not change. The standard errors shrink by a factor of about , and the -statistics rise by about .
and both double, so is unchanged. The residuals repeat, so RSS doubles while the degrees of freedom almost double, and is about the same. Since halves, the variance estimate halves. Exactly, with rows and coefficients, the standard errors scale by , which for and is , next to .
Why it matters. Nothing has been learned, yet the -statistic has grown. Overlapping data do the same thing: 20-day returns sampled daily look like 20 times the data, while holding about one independent observation per 20 days. With a slow signal the -statistic is overstated by about . Use non-overlapping samples or standard errors that allow for the overlap.
Question 18.3 ★ QR, QT, Trader, Risk • any • junior
A stock has a volatility of 30% a year and an index has 15%, with correlation . How many dollars of the index should you short per dollar of stock to make the hedged position’s variance as small as possible? What volatility is left? What goes wrong if you take the ratio from the regression of the index on the stock, and invert it?
Answer
Answer to Question 18.3.
Short dollars of the index per dollar of stock. The hedged position has a volatility of 18%. Using the inverted reverse regression, you would short dollars and leave .
The variance of stock minus times index is a quadratic in , minimised at . This is the slope of the stock regressed on the index. The residual volatility is , so the hedge removes of the variance.
The regression of the index on the stock has slope , and inverting it gives . The variance is then , a volatility of . It over-hedges by the factor .
Why it matters. This is a daily decision on a desk. Note also that an estimated ratio on noisy returns tends to come out low, not high, because noise in the regressor shrinks the slope towards zero.
Question 18.4 ★ QR, DS, Risk, Analyst • any • junior
A regression with an intercept reports . What values can it take, and what does tell you? What happens to it when you add one more regressor? If you drop the intercept but still compute , where RSS is the sum of squared residuals, what can happen?
Answer
Answer to Question 18.4.
With an intercept, lies in , and means that every residual is zero. Adding a regressor can never lower it. Without an intercept, that formula can be far below zero.
With an intercept, the total sum of squares splits into explained plus residual, because the residuals are orthogonal to the fitted values and sum to zero. So is a ratio between 0 and 1, and it equals the squared correlation of with the fitted values. A new regressor can reproduce the old fit by taking a zero coefficient, so RSS cannot rise.
Without an intercept, the fit is not obliged to do as well as the mean. If has a large mean and is centred on zero, RSS is close to , which is much larger than , and the formula gives a large negative number.
Classic wrong answer. Reading a higher from an added regressor as evidence. It rises even for pure noise.
Follow-up. And out of sample? It can be negative for any model, when the model predicts worse than the mean.
Question 18.5 ★ QR, QT, Analyst, Risk • hedge fund, bank • junior
You regress a fund’s returns on the market’s and estimate an alpha, the regression’s intercept, of 2% a year. The residuals have a volatility of 10% a year, and you have 4 years of data. What is the -statistic of the alpha? If the true alpha is 2%, how many years of data would you need for a -statistic of 2?
Answer
Answer to Question 18.5.
The -statistic is , and you would need 100 years to reach a -statistic of 2.
The standard error of the intercept is about the residual volatility divided by the square root of the number of years, a year. So . In terms of the information ratio, the alpha divided by residual volatility, here , you have . To reach 2 requires .
Follow-up. What if the information ratio were 1? Then takes 4 years.
Why it matters. An alpha of this size cannot be confirmed from track record in a working lifetime. In practice you lean on the economic logic of the strategy, on a much higher frequency of independent bets, or on cross-sectional evidence. Performance alone is not enough.
Question 18.6 ★ QR, QT, DS • hedge fund, market maker, crypto • junior
You regress daily returns on a standardised signal using 2 500 days of data and get . What is the -statistic of the slope? Is the signal worth anything? Estimate the annual Sharpe ratio of holding a position proportional to the signal, where the Sharpe ratio is mean return divided by its standard deviation.
Answer
Answer to Question 18.6.
The -statistic is about . The signal may be valuable, with an annual Sharpe ratio of about .
A simple regression has the exact identity
so . A low with a high is normal: grows with the sample, and does not.
The correlation with the return is . Holding a position proportional to the standardised signal earns , with mean about and standard deviation about , so the daily Sharpe ratio is about . Annualised, . The same answer comes from .
Classic wrong answer. “An of half a percent means it explains nothing.” On daily returns that is a strong signal, before costs.
Why it matters. Judge return prediction by Sharpe ratio after costs. This calculation also assumes the data did not come out of a search over many signals, and that is usually what you should check next.
Question 18.7 ★★ QR, QD, DS, Risk • any • junior
Derive by hand the least squares estimate of in . When does it exist? Why do you not compute it by inverting ? How do you fit it when is too large to fit in memory?
Answer
Answer to Question 18.7.
The estimator is , and it exists uniquely when has full column rank.
Minimise . Setting the gradient to zero gives the normal equations . The Hessian is positive semidefinite, so this is a minimum, and it is unique if is invertible, which is the same as full column rank. With fewer rows than columns, or with a repeated column, there are many solutions.
Geometrically, is the orthogonal projection of onto the column space of . So the residuals are orthogonal to every column, and with an intercept they sum to zero.
Do not invert. The condition number of is the square of that of , so inverting loses twice as many digits. Solve by QR on , or by Cholesky on if is well conditioned.
If does not fit in memory, read it in chunks and accumulate the matrix and the vector . They are sums over rows, so this gives the exact answer with memory proportional to .
Follow-up. And when rows arrive one at a time? Update the inverse with recursive least squares, and add a forgetting factor if the relation drifts.
Question 18.8 ★★ QR, QT, DS, Risk • any • junior, experienced
You want the coefficient of in a regression of on and . Procedure A regresses on , and then regresses those residuals on . Procedure B regresses on and on , and then regresses the first set of residuals on the second. Which gives the same coefficient as the full regression? If and have correlation and the true coefficient of is 1, what does the other procedure give?
Answer
Answer to Question 18.8.
Procedure B gives the full-regression coefficient exactly. Procedure A gives here, not 1.
This is the Frisch–Waugh–Lovell theorem: the coefficient of in the full regression equals the slope of the residuals of on the residuals of , after removing from both. Removing from only leaves still carrying its part, which is unrelated to the residuals of and dilutes the slope. Writing for the part of not explained by ,
Classic wrong answer. “Partial out the market from returns, and then test the signal on the residuals.” A common workflow, and it is procedure A. It biases the signal’s coefficient towards zero by , and worse if the signal is highly correlated with the factor.
Why it matters. Neutralise the signal as well as the returns. If you sector-neutralise only the returns and your signal has a sector tilt, you understate what the signal would earn after you hedge it.
Question 18.9 ★★ QR, QT, DS, Risk • any • junior
The true model is , where and have unit variance and correlation , and is independent noise. You do not observe , and you regress on alone. What slope do you get in a large sample?
Answer
Answer to Question 18.9.
The slope is . The sign is wrong: the true coefficient of is .
This is omitted-variable bias. The slope of the short regression is . Substituting the true model,
In general, the short slope is the true coefficient, plus the coefficient of multiplied by the slope of on . It disappears only if has no effect, or if and are uncorrelated, and it does not shrink with more data.
Follow-up. And if and are uncorrelated? The slope is 1, unbiased. The omitted only adds to the noise.
Why it matters. A signal correlated with market beta or sector will pick up their returns. Before believing a signal, regress it on the known factors and look at what remains.
Question 18.10 ★★ QR, QT, DS, Risk • any • junior, experienced
The true relation is . You observe , where and the noise each have variance 1 and are independent. In a large sample, what slope do you get when you regress on ? What if the measurement noise is in and not in ? If both are noisy, how can you bracket the true slope with two regressions?
Answer
Answer to Question 18.10.
Noise in gives a slope of . Noise in alone leaves the slope at 1. With noise in both, the true slope lies between the slope of on and the inverse of the slope of on .
This is errors-in-variables. Noise in the regressor raises and leaves the covariance alone:
The factor is the attenuation. Noise in goes into the error term: it widens the standard errors but causes no bias.
With noise in both, the slope of on is too flat and the inverse of the slope of on is too steep. With the numbers above and unit noise in as well, these are and , around the true value of 1.
Follow-up. Is there a single line that treats and alike? Total least squares minimises perpendicular distance and takes the first principal direction. Its slope is , here exactly 1. It assumes equal noise in the two variables and depends on their units, so standardise first or use the known noise ratio.
Why it matters. Estimated betas, volatilities and signals are all noisy, so regressions on them come out flat. If you size a hedge from a noisy regressor, you under-hedge.
Question 18.11 ★★ QR, DS, Risk • any • junior
Two regressors have correlation . By what factor is the standard error of each coefficient larger than if they were uncorrelated? What can you still estimate well? Can both -statistics be below 2 while the -test for the two together is highly significant?
Answer
Answer to Question 18.11.
Each standard error is larger by a factor of about . The sum of the coefficients is still well estimated, and yes, both -statistics can be small while is large.
The variance inflation factor is , and its square root is .
For unit-variance regressors, the covariance of the coefficients is proportional to the inverse of . That gives and . The data pin down the sum 19 times more tightly than the difference, because the two regressors nearly always move together. The difficulty is in dividing the credit between them, which shows up as coefficients that flip sign between samples.
The -test looks at the joint effect, so it does not suffer. With 100 observations and , the test statistic is , far above the 5% critical value of about . In a simulation with correlation and true coefficients of each, over half the samples have both , and most of these still have a significant .
Why it matters. Drop one, combine them, or use ridge. If you only need predictions and the correlation is stable, you may do nothing, as collinearity does not harm the fit.
Question 18.12 ★★ QR, QT, DS • any • junior
A point is chosen uniformly in the triangle with corners , and . Find the population regression line of on , and the regression line of on . What is the correlation of and ?
Answer
Answer to Question 18.12.
The two lines are and . The correlation is .
Because the region gives simple conditional means, you can write the regression directly. Given , the height is uniform on , so . Given , the value is uniform on , so . Both are straight lines, and so each is also the population regression line, as shown in Figure 18.1. Both slopes are , and the product of slopes equals , so .
As a check by integration, , , both variances are and the covariance is . So each slope is .
Classic wrong answer. Taking the diagonal edge, , as the line of the data. It is the boundary of the region, and not a regression line.
Question 18.13 ★★ QR, DS, QD • any • junior, experienced
You accidentally include the same column twice in a regression. What does ordinary least squares do? What does ridge do? What does lasso do?
Answer
Answer to Question 18.13.
OLS has no unique solution, since only the sum of the two coefficients is identified. Ridge splits the coefficient equally. Lasso does not care how it splits, so the solver decides.
For OLS, is singular, and any pair with the right sum fits equally well. A pseudo-inverse returns the minimum-norm solution, which splits equally, and a plain inverse fails or returns huge numbers of opposite sign.
For ridge, the penalty for a given sum is smallest when they are equal. Each coefficient is , and their sum is . So doubling a column cuts its effective penalty in half.
For lasso, is the same for every split with the same sign, so all such splits have an equal objective. Coordinate descent from zero tends to load everything on the first column and leave the second at zero. This depends on the order and the start.
Why it matters. With nearly identical signals the behaviour is similar, with lasso’s choice jumping from day to day and creating turnover with no economic meaning. Ridge or a grouping of the signals is more stable.
Question 18.14 ★★ QR, DS • any • junior, experienced
The columns of are orthonormal, so that , and the ordinary least squares coefficients are , and . Find the coefficients that minimise (lasso), and those that minimise (ridge), with . Derive the rule you use.
Answer
Answer to Question 18.14.
Lasso gives , and ridge gives .
With orthonormal columns, the objective separates into one problem per coefficient. Up to constants, , where is the OLS coefficient.
For ridge, minimising gives : every coefficient is divided by 2.
For lasso, minimise . If the derivative is zero at , which requires . The case is symmetric. If , the kink at zero is the minimum. This is soft-thresholding,
plotted in Figure 18.2. So , , and .
Follow-up. Why is there no closed form in general? The absolute value is not differentiable, and non-orthogonal columns couple the coefficients. It is solved by coordinate descent, which applies this same rule one coefficient at a time. It can also be written as a quadratic program, by setting with and using as the penalty.
Follow-up. And without the in front of the squared error? The threshold becomes .
Question 18.15 ★★ QR, QT, DS, Risk, Analyst • any • junior
Under what assumptions are the coefficients of a linear regression unbiased, and under what further assumptions are their standard errors correct? On daily stock returns, which of these fail, and what do you do about each?
Answer
Answer to Question 18.15.
The coefficients are unbiased under linearity, exogeneity and full rank. The usual standard errors also need errors with constant variance and no correlation. Normal errors are not needed for large samples.
For unbiasedness, you need , and full column rank. For correct standard errors and the best-linear-unbiased property, you also need homoskedastic and uncorrelated errors. Normality matters only for exact small-sample tests.
On daily stock returns:
- Volatility moves. Coefficients stay unbiased but standard errors are wrong. Use robust (White) standard errors, or scale by a volatility forecast.
- Errors are correlated, especially with overlapping horizons. Use Newey–West or Hansen–Hodrick standard errors, or non-overlapping data.
- Fat tails. A few days dominate the fit. The test level holds up reasonably with thousands of points, but check influence, and consider Huber regression or winsorising.
- Exogeneity fails through omitted factors and look-ahead in features. This one causes bias, and more data will not fix it. Control for factors and time-stamp strictly.
- Relations drift. Fit on rolling or exponentially weighted windows, and test stability across sub-periods.
- Regressors are noisy. Slopes shrink towards zero.
- Regressors are nearly collinear. Coefficients are unstable. Use ridge or combine them.
Classic wrong answer. “The errors must be normal for OLS to be unbiased.” Normality has nothing to do with bias.
Question 18.16 ★★ QR, QT, DS • any • junior
You regress on 20 regressors with 100 observations and an intercept, and in truth is independent of all of them. What is the expected ? What is the expected adjusted ? How many of the 20 coefficients do you expect to have ?
Answer
Answer to Question 18.16.
The expected is , the expected adjusted is 0, and about one coefficient has .
Under the null, follows a Beta distribution with mean . Each of the 20 regressors uses up one of the 99 degrees of freedom beyond the mean, and each one captures an equal share of the variance by chance.
The adjustment was built to average zero in this case.
Each -statistic has 79 degrees of freedom, and , so the expected count is .
Why it matters. The in-sample of 20% on noise tells you what to expect from a fit with many signals on little data. Compare your results with this baseline, and judge on out-of-sample results.
Question 18.17 ★★ QR, QT, Risk, DS • bank, hedge fund • junior
You generate two independent random walks, each 250 steps long, and regress one on the other, using the levels. How often is the slope “significant” with , and what do you see on average? What changes with 1 000 steps? What should you do with price series instead?
Answer
Answer to Question 18.17.
With 250 steps, about 85% of the regressions are “significant”, with an average of about . With 1 000 steps, the share rises to about 93%, while stays where it is. Use returns, or test for cointegration.
This is spurious regression. Both series wander, and any two wandering series look related over a finite window. The standard theory assumes stationary errors, and here the residuals are themselves a random walk, so the -statistic has no limiting distribution. It grows like : going from 250 to 1 000 steps doubles its dispersion. The slope does not converge, and it remains random even with infinite data. These figures come from a seeded simulation.
Differencing cures it. Regressing returns on returns gives about 5% of the time, as it should, with close to zero.
Follow-up. When is a level regression meaningful? When the two series are cointegrated, so that a linear combination of them is stationary. The residuals then do not wander, and that is what you test: for example a unit-root test on the residuals, with the appropriate critical values.
Why it matters. Two price charts that move together are not evidence. A trading pair needs a stationary spread, and tests on price levels will look wonderful for almost any pair.
Question 18.18 ★★ QR, QT, DS • hedge fund, market maker, bank • junior, experienced
You have 500 weak and correlated return signals and 5 years of daily data, about 1 250 observations. Would you fit ridge or lasso? What would change your mind?
Answer
Answer to Question 18.18.
Ridge, unless you have a reason to believe that a few signals carry almost all of the information.
Lasso assumes sparsity, and it pays for selecting variables with instability: among correlated signals it picks one somewhat at random and changes its pick between samples, which adds turnover. Ridge keeps them all and shrinks along the low-variance directions. With , many small effects and a weak signal, reducing variance matters most.
In a seeded simulation with 500 signals, correlated through ten factors, and 1 250 observations, where all signals have a small random effect, the out-of-sample is about 1.1% for ridge and about 0.8% for lasso, each with its best penalty. With just 5 strong signals and 495 useless ones, lasso comes out ahead.
Change your mind if you have good reason for sparsity, if you want interpretability or fewer inputs to maintain, or if each signal costs money to run. Elastic net is a reasonable compromise.
Follow-up. What should you be careful of? Standardise the signals, do not penalise the intercept, and choose the penalty by time-ordered validation with a gap. Random folds leak information through autocorrelation.
Question 18.19 ★★ QR, QT, Risk, Trader • bank, hedge fund • junior, experienced
A stock’s true daily return is exactly times the market’s. But it trades only on a random half of days, and on other days its price simply stays at the last trade. You regress its observed daily return on the same day’s market return. What slope do you get? How do you recover ?
Answer
Answer to Question 18.19.
The slope is , half of . Regressing on the current and several lagged market returns and summing the coefficients recovers , and a longer return horizon does much the same.
A day’s market move shows up in the stock’s price on the first later day when it trades, and each day it trades with probability . So a fraction of the move shows up the same day, a fraction one day later, two days later, and so on. Regressing on the market’s returns at several lags therefore gives slopes , , , and so on, and their sum is the true . Ignoring the lags leaves .
The other cure is to lengthen the return horizon, since a smaller share of the move misses the window. With weekly returns in this model, only the moves late in the week can miss it, and on average of a week’s move does. So the slope is about .
Why it matters. Illiquid names and instruments quoted at different closing times all show low beta and low correlation on daily data. Asian and US closes, for example, are hours apart. Do not mistake this for diversification: at longer horizons the correlation is back. The same effect drives correlation down at very high frequencies.
Question 18.20 ★★★ QR, DS, Risk • any • junior, experienced
Let be standard normal and , with standard normal and independent of , so that the noise is large when is large. With a large sample of size , what is the true standard error of the OLS slope, and what does the usual formula report? How do you fix the standard errors, and how could you use this to improve the estimate?
Answer
Answer to Question 18.20.
The true standard error is , and the usual formula reports . So it understates the truth by a factor of .
The slope error is , with . With many observations, its variance is
since and the fourth moment of a standard normal is 3. The usual formula is with , so it gives . It uses the average noise, and misses that the noise is largest exactly where has the most influence on the slope.
To fix the standard errors, use the White sandwich estimator: with demeaned . It estimates the directly and matches the true dispersion in a simulation.
To improve the estimate, use weighted least squares, which weights each point by the inverse of its noise variance, here . In this case that makes the estimate the mean of , with variance , a third of the OLS variance.
Follow-up. Each of your observations is the average of a different number of underlying data points. What weights do you use? , since the variance of an average is .
Follow-up. You have two independent estimates of the same number, with standard errors 2 and 1. How do you combine them? With inverse-variance weights and , and a standard error of .
Question 18.21 ★★★ QR, QT, DS • hedge fund, market maker • junior, experienced
Daily returns are independent, and a signal is unrelated to them. You regress the next 20 days’ total return on today’s signal, sampling every day. By what factor do the usual standard errors understate the truth if the signal is (a) independent from day to day, (b) nearly constant over 20 days, (c) an autoregressive process of order 1 with coefficient ?
Answer
Answer to Question 18.21.
The answers are (a) a factor of 1, so no understatement at all, (b) about , and (c) about .
The usual formula assumes that is uncorrelated over time. In fact, the variance of the slope is larger by the factor
where and are the autocorrelations of the regressor and of the error. Two 20-day windows starting days apart share days, so for .
(a) If the signal is independent from day to day, , the factor is 1. Overlap in alone does no harm to the slope’s standard error. Many candidates miss this.
(b) If the signal is nearly constant, , the factor is , so the standard errors are too small by .
(c) With , the factor is , whose square root is . Simulations reproduce (a) and (c), and (b) is the limit of the same formula.
The fix is Newey–West or Hansen–Hodrick standard errors, with the number of lags at least the overlap. Newey–West’s weights shrink with the lag, so use more than that: in the simulation with 40 lags it comes within 20% of the truth for case (c).
Follow-up. What about plain autocorrelated errors with no overlap? With AR(1) in both regressor and error, each with coefficient , the factor is , so the standard errors are too small by . The Durbin–Watson statistic, which is about , is the quick check on the residuals.
Question 18.22 ★★★ QR, DS, QT • any • junior, experienced
has correlation with and correlation with , but you do not know the correlation between and . What values can the of the regression of on both take? Then a different case: is uncorrelated with , has correlation with , and and have correlation . Is useless?
Answer
Answer to Question 18.22.
can take any value from to 1. And no, is far from useless: with both regressors the is , against for alone.
For two regressors with correlations , with and with each other,
With this is . As , the two regressors are the same variable and . Lowering raises . The correlation matrix of must be positive semidefinite, which here requires . At that value .
In the second case, with , and , . This is a suppressor variable: has no relation to directly, but it cancels the part of that is noise for predicting .
Classic wrong answer. “Joint is at most the sum of the separate values,” or “a variable with zero correlation with cannot help.” Both are false.
Why it matters. Do not screen signals one at a time by correlation with the target. A hedge is the same idea: an instrument uncorrelated with your target can still reduce your risk once you hold another position.
Question 18.23 ★★★ QR, QT • hedge fund, market maker, crypto • experienced
Two signals each have correlation with the next day’s return. What correlation can the best linear combination of them reach if their correlation with each other is , , or ? In the case of , suppose the second signal’s correlation with the return is and not . What sign should its weight have?
Answer
Answer to Question 18.23.
The best combination reaches , and in the three cases. With correlations and and , the second signal’s weight is negative, even though it predicts positively by itself.
The best linear combination’s correlation with the target is , and the formula for two regressors gives with equal correlations. For :
Diversification works: correlated signals add little, independent ones add as , and negatively correlated signals with the same sign of prediction add more.
The optimal weights are . With and ,
The second signal’s own correlation of is less than the it would get just by being correlated with the first. So it is shorted against the first, which adds a little: the correlation is against alone.
Why it matters. This is the regression of return on signals, and it shows why combining beats selecting. The gain from to is modest but real: an annual Sharpe ratio of about , against . Note how little it takes for the sign of a weight to flip, so shrink the weights.
Question 18.24 ★★★ QR, DS • any • experienced
A regression has one regressor with , and noise of variance . The true coefficient is . OLS gives , and ridge gives . Which minimises the mean squared error of the estimate, and how much lower is that error than for OLS? What does this say about shrinkage for weak signals?
Answer
Answer to Question 18.24.
The best value is , which gives a mean squared error of against 1 for OLS, an 80% reduction.
The ridge estimate has bias and variance , so
Setting the derivative to zero gives , and the minimum is . With and , that is and . The estimate is : throw away four fifths of it.
The weaker the signal relative to noise, the more you should shrink. A signal with a true -statistic of should be cut hard, while one with gets only . Of course is unknown, which is why you choose by validation. But the conclusion stands: in low signal-to-noise settings, unbiased estimates are poor bets.
Follow-up. What is the Bayesian reading? With prior , the posterior mean is the ridge estimate with . For that again multiplies the estimate by .
Follow-up. And with many regressors? In the singular value basis, each direction is multiplied by , so the directions with little variance in are shrunk the most.
Question 18.25 ★★★ QR, QT, Risk, DS • any • junior, experienced
and are jointly normal with unit variance and correlation . You keep only the observations with and regress on . What slope and correlation do you get? What slope do you get if instead you keep only the observations with ?
Answer
Answer to Question 18.25.
Keeping leaves the slope at and lowers the correlation to about . Keeping lowers the slope to about .
Selecting on leaves the relation intact: given , still has mean , so the slope remains . Only the spread of falls. The variance of a standard normal above zero is . The correlation falls because the explained variance falls:
Selecting on breaks the relation, because now the noise matters: for low , you keep only the points with a large positive error. So the errors are no longer independent of , and the slope falls. Using the normal relation, with and the same variance for above zero, you get and , so
Why it matters. Filtering on a variable you use as a regressor is safe for the slope. Filtering on the outcome is not, and that includes keeping only survivors, only filled orders or only profitable trades. For example, a study of “stocks that went up” or “orders that filled” will be biased, and no amount of data will help.
Question 18.26 ★★★ QR, DS, Risk • bank, hedge fund • junior, experienced
A regression of on with an intercept has 1 000 observations, where has mean 0 and . One observation has and residual 2. Without refitting, find its leverage, the change in the slope if you remove it, and the prediction error for it from a fit without it.
Answer
Answer to Question 18.26.
Its leverage is , removing it lowers the slope by about , and its out-of-sample prediction error is about .
Leverage is the diagonal of the hat matrix, how much the observation’s own value moves its fitted value. With an intercept,
The leverages sum to the number of coefficients, so the average here is , and this point has over 50 times that.
Deleting a point has exact formulas, so no refit is needed:
Follow-up. Why does this matter computationally? The same formula gives the full leave-one-out cross-validation error from a single fit, by dividing each residual by .
Why it matters. One observation with large can drive the slope, and its residual is small because the line has moved towards it. So look at leverage and not only at residuals. On return data this means the crash days. Check that the sign survives without them, or limit the regressor itself, by winsorising or using a bounded-influence fit. A Huber loss alone will not do it, since it caps large residuals, and a high-leverage point can have a small one.
Question 18.27 ★★★ QR, QT, DS • hedge fund, bank, market maker • experienced
The true model is , and , where , and are independent with unit variance. So is correlated with the error . What slope does OLS of on give in a large sample? How do you use to get the true slope? What goes wrong if is only weakly related to ?
Answer
Answer to Question 18.27.
OLS gives , not 1. The instrument gives . A weak instrument gives a very wide estimate, biased towards OLS.
OLS has slope . Here , and , so : and the error move together, and the regression gives the credit.
The variable is an instrument: it moves , and it has no other route to . Then , since is uncorrelated with . So . Two-stage least squares gives the same number: regress on , then on the fitted values. But if you do that by hand, the second-stage standard errors are wrong, because they use the wrong residuals.
With a weak instrument, the denominator is close to zero and noisy, and a small error in it moves the ratio a lot. In a simulation with and 200 observations, the median estimate is pulled well above 1 towards the OLS value, and the spread is very wide. Always look at the first-stage regression.
Why it matters. A regression of returns on order flow has this problem: prices and flow respond to the same news. Estimating price impact by plain OLS overstates it, since informed flow comes with moves it did not cause. Use flow that is unrelated to news, such as index-rebalance trades or a randomised execution schedule, as an instrument.
Question 18.28 ★★★ QR, QT, DS • hedge fund, market maker • junior, experienced
You fit an OLS regression with 20 regressors on 1 000 observations, and the true of the best linear predictor is 1%. Roughly what should you expect out of sample, measured against predicting the true mean? How much data would you need for the out-of-sample to reach zero?
Answer
Answer to Question 18.28.
Expect about , a negative number. You need about 1 980 observations before the out-of-sample reaches zero.
With estimated coefficients and observations, each coefficient has an estimation error, and the error of the prediction grows accordingly. With well-behaved regressors, the out-of-sample mean squared error is approximately the noise variance times . With a total variance of 1, the noise variance is , so
The in-sample of the same fit is about 3%, since it adds rather than subtracting it. Setting the out-of-sample figure to zero gives . For one regressor the break-even is just 99 observations.
Classic wrong answer. “The true relation is positive, so the fit must beat the mean.” A real but weak signal, estimated with too many coefficients, loses to the plain average. Its estimation error is larger than its signal.
Why it matters. This is the most common reason for a backtest that fails in live trading even with no bug in sight. The fix is to reduce or to shrink: ridge costs a little bias and removes a large part of the term.
Question 18.29 ★★★★ QR, QT • hedge fund • experienced
Consider and , where , , the shocks and have unit variance and correlation , and you have 120 observations. You regress on with an intercept. Roughly what is the mean of the estimated slope? You test against with the usual -statistic at a nominal 5% level. Does the test reject more or less often than 5%, and roughly how often?
Answer
Answer to Question 18.29.
The mean slope is about , even though the truth is 0. The test rejects far too often: about 16% of the time, not 5%.
This is the Stambaugh bias. The regressor is uncorrelated with the next shock, but it is not exogenous: it depends on past values of through . Write , with independent of and . The slope of on is exactly , so
and the last term has mean zero.
So the error in is the error in the persistence estimate, multiplied by . Persistence is underestimated in short samples: the standard approximation is . So . A seeded simulation gives a mean slope of , a bias in of , and a mean -statistic of about . The test rejects about 16% of the time. You can size this at the board. With , the standard error is at least about , as large as the bias, so the -statistic shifts up by at most about 1. On a normal approximation, a shift of to 1 moves the rejection rate from 5% to between and . The simulated 16% is just below that range, since the mean shift is at the low end and the statistic’s spread is a little under 1.
Why it matters. This is the textbook setting for predicting returns with a valuation ratio such as the dividend yield: a price rise raises returns and lowers the ratio, so is strongly negative, and the ratio is very persistent. Part of the evidence in such a regression is this bias. Reduce it by adjusting with an estimate of , or test with a null distribution from a simulation.
Follow-up. The same bias appears when you fit mean reversion. What does it do? It overstates the speed of reversion. With the true half-life is periods. The mean estimate on 120 points, , implies .
Question 18.30 ★★★★ QR, QT, DS • hedge fund, bank • experienced
, so only matters. You observe , a noisy version of with noise variance , along with a second variable . Both and have unit variance, and their correlation is , and has no effect on once is known. You regress on and . What coefficients do you get in a large sample? What would you conclude about , and what is the error?
Answer
Answer to Question 18.30.
The coefficients are about on and about on . You would conclude that has a strong effect, and that is false. Its coefficient only reflects the noise in .
Solve the normal equations in the population. Let and . Then , , and , which gives
The solution is
When the coefficient on is zero, as it should be. As grows, the regression trusts less and leans on , because is a clean proxy for . In the limit, goes to , the coefficient of on alone.
More data does not help. The bias stays while the standard error shrinks, so the -statistic grows without limit. With 2 500 observations it is well above 8 in a simulation.
Classic wrong answer. Thinking that noise in one regressor affects only that regressor’s coefficient. The bias spreads to any correlated regressor.
Why it matters. This is how a new factor can “survive controls” while adding nothing. If the existing factor you control for is measured with noise, such as a stale book value or a noisy beta, any variable correlated with it will look significant.