量化金融 · 第 18 册 · 职业发展

Interviews I: Maths, Probability and Speed

本书暂未推出简体中文版。现有版本: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 yy on xx and get a slope of 2. What values can the slope of the reverse regression, xx on yy, take? If the reverse slope turns out to be 0.180.18, what is the correlation of xx and yy?

Answer

Answer to Question 18.1.

The reverse slope can be anything above 0 and up to 1/21/2. A reverse slope of 0.180.18 means a correlation of 0.60.6.

With b1=Cov(x,y)/Var(x)b_1 = \mathrm{Cov}(x,y)/\mathrm{Var}(x) and b2=Cov(x,y)/Var(y)b_2 = \mathrm{Cov}(x,y)/\mathrm{Var}(y), the product is

b1b2=Cov(x,y)2Var(x)Var(y)=ρ2.b_1 b_2 = \frac{\mathrm{Cov}(x,y)^2}{\mathrm{Var}(x)\mathrm{Var}(y)} = \rho^2 .

So b2=ρ2/2b_2 = \rho^2/2, with ρ2\rho^2 in (0,1](0, 1]. The two slopes always have the same sign. If b2=0.18b_2 = 0.18 then ρ2=0.36\rho^2 = 0.36, and the correlation is 0.60.6, positive because the slopes are.

Classic wrong answer. “b2=1/b1=1/2b_2 = 1/b_1 = 1/2.” That holds only with ∣ρ∣=1|\rho| = 1. 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 tt-statistics and R2R^2? Why does this matter when your observations overlap in time?

Answer

Answer to Question 18.2.

The coefficients and R2R^2 do not change. The standard errors shrink by a factor of about 2\sqrt2, and the tt-statistics rise by about 2\sqrt2.

X⊤XX^\top X and X⊤yX^\top y both double, so β^=(X⊤X)−1X⊤y\hat\beta = (X^\top X)^{-1}X^\top y is unchanged. The residuals repeat, so RSS doubles while the degrees of freedom almost double, and s2s^2 is about the same. Since (X⊤X)−1(X^\top X)^{-1} halves, the variance estimate halves. Exactly, with nn rows and pp coefficients, the standard errors scale by (n−p)/(2n−p)\sqrt{(n-p)/(2n-p)}, which for n=250n = 250 and p=2p = 2 is 0.7060.706, next to 1/2=0.7071/\sqrt2 = 0.707.

Why it matters. Nothing has been learned, yet the tt-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 tt-statistic is overstated by about 20≈4.5\sqrt{20} \approx 4.5. 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 0.80.8. 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 1.61.6 dollars of the index per dollar of stock. The hedged position has a volatility of 18%. Using the inverted reverse regression, you would short 2.52.5 dollars and leave 22.5%22.5\%.

The variance of stock minus hh times index is a quadratic in hh, minimised at h=Cov/Var(index)=ρ σs/σi=0.8⋅30/15=1.6h = \mathrm{Cov}/\mathrm{Var}(\text{index}) = \rho\,\sigma_s/\sigma_i = 0.8 \cdot 30/15 = 1.6. This is the slope of the stock regressed on the index. The residual volatility is σs1−ρ2=30⋅0.6=18%\sigma_s\sqrt{1 - \rho^2} = 30 \cdot 0.6 = 18\%, so the hedge removes ρ2=64%\rho^2 = 64\% of the variance.

The regression of the index on the stock has slope ρ σi/σs=0.4\rho\,\sigma_i/\sigma_s = 0.4, and inverting it gives 2.52.5. The variance is then 302+2.52⋅152−2⋅2.5⋅360=506.2530^2 + 2.5^2 \cdot 15^2 - 2 \cdot 2.5 \cdot 360 = 506.25, a volatility of 22.5%22.5\%. It over-hedges by the factor 1/ρ21/\rho^2.

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 R2R^2. What values can it take, and what does R2=1R^2 = 1 tell you? What happens to it when you add one more regressor? If you drop the intercept but still compute 1−RSS/∑(yi−yˉ)21 - \text{RSS}/\sum (y_i - \bar y)^2, where RSS is the sum of squared residuals, what can happen?

Answer

Answer to Question 18.4.

With an intercept, R2R^2 lies in [0,1][0, 1], and R2=1R^2 = 1 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 R2R^2 is a ratio between 0 and 1, and it equals the squared correlation of yy 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 yy has a large mean and xx is centred on zero, RSS is close to ∑yi2\sum y_i^2, which is much larger than ∑(yi−yˉ)2\sum(y_i - \bar y)^2, and the formula gives a large negative number.

Classic wrong answer. Reading a higher R2R^2 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 tt-statistic of the alpha? If the true alpha is 2%, how many years of data would you need for a tt-statistic of 2?

Answer

Answer to Question 18.5.

The tt-statistic is 0.40.4, and you would need 100 years to reach a tt-statistic of 2.

The standard error of the intercept is about the residual volatility divided by the square root of the number of years, 10%/4=5%10\%/\sqrt4 = 5\% a year. So t=2/5=0.4t = 2/5 = 0.4. In terms of the information ratio, the alpha divided by residual volatility, here 0.20.2, you have t=ratio⋅yearst = \text{ratio} \cdot \sqrt{\text{years}}. To reach 2 requires years=2/0.2=10\sqrt{\text{years}} = 2/0.2 = 10.

Follow-up. What if the information ratio were 1? Then t=2t = 2 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 R2=0.5%R^2 = 0.5\%. What is the tt-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 tt-statistic is about 3.543.54. The signal may be valuable, with an annual Sharpe ratio of about 1.11.1.

A simple regression has the exact identity

t2=R2 (n−2)1−R2,t^2 = \frac{R^2\,(n - 2)}{1 - R^2},

so t=0.005⋅2498/0.995≈3.54t = \sqrt{0.005 \cdot 2498/0.995} \approx 3.54. A low R2R^2 with a high tt is normal: tt grows with the sample, and R2R^2 does not.

The correlation with the return is 0.005≈0.071\sqrt{0.005} \approx 0.071. Holding a position proportional to the standardised signal xx earns xyxy, with mean about ρ σy\rho\,\sigma_y and standard deviation about σy\sigma_y, so the daily Sharpe ratio is about ρ\rho. Annualised, 0.071⋅252≈1.120.071 \cdot \sqrt{252} \approx 1.12. The same answer comes from t/years=3.54/9.9t/\sqrt{\text{years}} = 3.54/\sqrt{9.9}.

Classic wrong answer. “An R2R^2 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 β\beta in y=Xβ+εy = X\beta + \varepsilon. When does it exist? Why do you not compute it by inverting X⊤XX^\top X? How do you fit it when XX is too large to fit in memory?

Answer

Answer to Question 18.7.

The estimator is β^=(X⊤X)−1X⊤y\hat\beta = (X^\top X)^{-1}X^\top y, and it exists uniquely when XX has full column rank.

Minimise L(β)=∥y−Xβ∥2=y⊤y−2β⊤X⊤y+β⊤X⊤XβL(\beta) = \lVert y - X\beta\rVert^2 = y^\top y - 2\beta^\top X^\top y + \beta^\top X^\top X\beta. Setting the gradient −2X⊤y+2X⊤Xβ-2X^\top y + 2X^\top X\beta to zero gives the normal equations X⊤Xβ=X⊤yX^\top X\beta = X^\top y. The Hessian 2X⊤X2X^\top X is positive semidefinite, so this is a minimum, and it is unique if X⊤XX^\top X 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, Xβ^X\hat\beta is the orthogonal projection of yy onto the column space of XX. So the residuals are orthogonal to every column, and with an intercept they sum to zero.

Do not invert. The condition number of X⊤XX^\top X is the square of that of XX, so inverting loses twice as many digits. Solve by QR on XX, or by Cholesky on X⊤XX^\top X if XX is well conditioned.

If XX does not fit in memory, read it in chunks and accumulate the p×pp \times p matrix X⊤XX^\top X and the vector X⊤yX^\top y. They are sums over rows, so this gives the exact answer with memory proportional to p2p^2.

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 xx in a regression of yy on xx and zz. Procedure A regresses yy on zz, and then regresses those residuals on xx. Procedure B regresses yy on zz and xx on zz, and then regresses the first set of residuals on the second. Which gives the same coefficient as the full regression? If xx and zz have correlation 0.80.8 and the true coefficient of xx 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 0.360.36 here, not 1.

This is the Frisch–Waugh–Lovell theorem: the coefficient of xx in the full regression equals the slope of the residuals of yy on the residuals of xx, after removing zz from both. Removing zz from yy only leaves xx still carrying its zz part, which is unrelated to the residuals of yy and dilutes the slope. Writing x~\tilde x for the part of xx not explained by zz,

slope of A=β⋅Var(x~)Var(x)=β (1−ρ2)=1⋅(1−0.64)=0.36.\text{slope of A} = \beta \cdot \frac{\mathrm{Var}(\tilde x)}{\mathrm{Var}(x)} = \beta\,(1 - \rho^2) = 1 \cdot (1 - 0.64) = 0.36 .

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 1−ρ21 - \rho^2, 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 y=x−3z+εy = x - 3z + \varepsilon, where xx and zz have unit variance and correlation 0.50.5, and ε\varepsilon is independent noise. You do not observe zz, and you regress yy on xx alone. What slope do you get in a large sample?

Answer

Answer to Question 18.9.

The slope is −0.5-0.5. The sign is wrong: the true coefficient of xx is +1+1.

This is omitted-variable bias. The slope of the short regression is Cov(x,y)/Var(x)\mathrm{Cov}(x, y)/\mathrm{Var}(x). Substituting the true model,

Cov(x, x−3z+ε)Var(x)=1−3⋅Cov(x,z)Var(x)=1−3⋅0.5=−0.5.\frac{\mathrm{Cov}(x,\, x - 3z + \varepsilon)}{\mathrm{Var}(x)} = 1 - 3 \cdot \frac{\mathrm{Cov}(x, z)}{\mathrm{Var}(x)} = 1 - 3 \cdot 0.5 = -0.5 .

In general, the short slope is the true coefficient, plus the coefficient of zz multiplied by the slope of zz on xx. It disappears only if zz has no effect, or if xx and zz are uncorrelated, and it does not shrink with more data.

Follow-up. And if xx and zz are uncorrelated? The slope is 1, unbiased. The omitted zz 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 y=x∗+εy = x^* + \varepsilon. You observe x=x∗+nx = x^* + n, where x∗x^* and the noise nn each have variance 1 and are independent. In a large sample, what slope do you get when you regress yy on xx? What if the measurement noise is in yy and not in xx? If both are noisy, how can you bracket the true slope with two regressions?

Answer

Answer to Question 18.10.

Noise in xx gives a slope of 1/21/2. Noise in yy alone leaves the slope at 1. With noise in both, the true slope lies between the slope of yy on xx and the inverse of the slope of xx on yy.

This is errors-in-variables. Noise in the regressor raises Var(x)\mathrm{Var}(x) and leaves the covariance alone:

slope=Cov(x∗+n, y)Var(x∗)+Var(n)=11+1=12.\text{slope} = \frac{\mathrm{Cov}(x^* + n,\, y)}{\mathrm{Var}(x^*) + \mathrm{Var}(n)} = \frac{1}{1 + 1} = \frac12 .

The factor Var(x∗)/Var(x)\mathrm{Var}(x^*)/\mathrm{Var}(x) is the attenuation. Noise in yy goes into the error term: it widens the standard errors but causes no bias.

With noise in both, the slope of yy on xx is too flat and the inverse of the slope of xx on yy is too steep. With the numbers above and unit noise in yy as well, these are 0.50.5 and 22, around the true value of 1.

Follow-up. Is there a single line that treats xx and yy alike? Total least squares minimises perpendicular distance and takes the first principal direction. Its slope is [(syy−sxx)+(syy−sxx)2+4sxy2 ]/(2sxy)\bigl[(s_{yy} - s_{xx}) + \sqrt{(s_{yy} - s_{xx})^2 + 4s_{xy}^2}\,\bigr]/(2s_{xy}), 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 0.90.9. By what factor is the standard error of each coefficient larger than if they were uncorrelated? What can you still estimate well? Can both tt-statistics be below 2 while the FF-test for the two together is highly significant?

Answer

Answer to Question 18.11.

Each standard error is larger by a factor of about 2.292.29. The sum of the coefficients is still well estimated, and yes, both tt-statistics can be small while FF is large.

The variance inflation factor is 1/(1−ρ2)=1/0.19=5.261/(1 - \rho^2) = 1/0.19 = 5.26, and its square root is 2.292.29.

For unit-variance regressors, the covariance of the coefficients is proportional to the inverse of (1ρρ1)\bigl(\begin{smallmatrix}1 & \rho\\ \rho & 1\end{smallmatrix}\bigr). That gives Var(b1+b2)∝2/(1+ρ)=1.05\mathrm{Var}(b_1 + b_2) \propto 2/(1 + \rho) = 1.05 and Var(b1−b2)∝2/(1−ρ)=20\mathrm{Var}(b_1 - b_2) \propto 2/(1 - \rho) = 20. 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 FF-test looks at the joint effect, so it does not suffer. With 100 observations and R2=0.2R^2 = 0.2, the test statistic is F=(0.2/2)/(0.8/97)≈12.1F = (0.2/2)/(0.8/97) \approx 12.1, far above the 5% critical value of about 3.13.1. In a simulation with correlation 0.950.95 and true coefficients of 0.20.2 each, over half the samples have both ∣t∣<2|t| < 2, and most of these still have a significant FF.

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 (0,0)(0,0), (1,0)(1,0) and (1,1)(1,1). Find the population regression line of yy on xx, and the regression line of xx on yy. What is the correlation of xx and yy?

Answer

Answer to Question 18.12.

The two lines are y=x/2y = x/2 and x=(1+y)/2x = (1 + y)/2. The correlation is 1/21/2.

Because the region gives simple conditional means, you can write the regression directly. Given xx, the height yy is uniform on [0,x][0, x], so E[y∣x]=x/2E[y \mid x] = x/2. Given yy, the value xx is uniform on [y,1][y, 1], so E[x∣y]=(1+y)/2E[x \mid y] = (1 + y)/2. Both are straight lines, and so each is also the population regression line, as shown in Figure 18.1. Both slopes are 1/21/2, and the product of slopes equals ρ2\rho^2, so ρ=1/2\rho = 1/2.

The triangle and its two regression lines. They cross at the mean point (2/3, 1/3). Drawn in the same axes, one line has slope 1/2 and the other slope 2, on either side of the slope 1 of the diagonal edge.
Figure 18.1. The triangle and its two regression lines. They cross at the mean point (2/3,1/3)(2/3, 1/3). Drawn in the same axes, one line has slope 1/21/2 and the other slope 2, on either side of the slope 1 of the diagonal edge.

As a check by integration, E[x]=2/3E[x] = 2/3, E[y]=1/3E[y] = 1/3, both variances are 1/181/18 and the covariance is 1/361/36. So each slope is (1/36)/(1/18)=1/2(1/36)/(1/18) = 1/2.

Classic wrong answer. Taking the diagonal edge, y=xy = x, 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, X⊤XX^\top X 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 b12+b22b_1^2 + b_2^2 for a given sum is smallest when they are equal. Each coefficient is x⊤y/(2x⊤x+λ)x^\top y/(2x^\top x + \lambda), and their sum is x⊤y/(x⊤x+λ/2)x^\top y/(x^\top x + \lambda/2). So doubling a column cuts its effective penalty in half.

For lasso, ∣b1∣+∣b2∣|b_1| + |b_2| 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 XX are orthonormal, so that X⊤X=IX^\top X = I, and the ordinary least squares coefficients are 33, −0.5-0.5 and 1.21.2. Find the coefficients that minimise 12∥y−Xb∥2+λ∥b∥1\tfrac12\lVert y - Xb\rVert^2 + \lambda\lVert b\rVert_1 (lasso), and those that minimise 12∥y−Xb∥2+λ2∥b∥22\tfrac12\lVert y - Xb\rVert^2 + \tfrac{\lambda}{2}\lVert b\rVert_2^2 (ridge), with λ=1\lambda = 1. Derive the rule you use.

Answer

Answer to Question 18.14.

Lasso gives (2,0,0.2)(2, 0, 0.2), and ridge gives (1.5,−0.25,0.6)(1.5, -0.25, 0.6).

With orthonormal columns, the objective separates into one problem per coefficient. Up to constants, 12∥y−Xb∥2=12∑j(bj−β^j)2\tfrac12\lVert y - Xb\rVert^2 = \tfrac12\sum_j (b_j - \hat\beta_j)^2, where β^j\hat\beta_j is the OLS coefficient.

For ridge, minimising 12(b−β^)2+λ2b2\tfrac12(b - \hat\beta)^2 + \tfrac{\lambda}{2}b^2 gives b=β^/(1+λ)b = \hat\beta/(1 + \lambda): every coefficient is divided by 2.

For lasso, minimise 12(b−β^)2+λ∣b∣\tfrac12(b - \hat\beta)^2 + \lambda|b|. If b>0b > 0 the derivative is zero at b=β^−λb = \hat\beta - \lambda, which requires β^>λ\hat\beta > \lambda. The case b<0b < 0 is symmetric. If ∣β^∣≤λ|\hat\beta| \le \lambda, the kink at zero is the minimum. This is soft-thresholding,

b=sign(β^) (∣β^∣−λ)+,b = \mathrm{sign}(\hat\beta)\,\bigl(|\hat\beta| - \lambda\bigr)_+ ,

plotted in Figure 18.2. So 3→23 \to 2, −0.5→0-0.5 \to 0, and 1.2→0.21.2 \to 0.2.

The estimate as a function of the OLS coefficient, with = 1 and orthonormal columns. Ridge divides by 2 everywhere. Lasso sets to zero everything inside [-1, 1] and subtracts 1 from the rest, so large coefficients keep a fixed bias.
Figure 18.2. The estimate as a function of the OLS coefficient, with λ=1\lambda = 1 and orthonormal columns. Ridge divides by 2 everywhere. Lasso sets to zero everything inside [−1,1][-1, 1] and subtracts 1 from the rest, so large coefficients keep a fixed bias.

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 b=b+−b−b = b^+ - b^- with b+,b−≥0b^+, b^- \ge 0 and using ∑(b++b−)\sum(b^+ + b^-) as the penalty.

Follow-up. And without the 12\tfrac12 in front of the squared error? The threshold becomes λ/2\lambda/2.

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 y=Xβ+εy = X\beta + \varepsilon, E[ε∣X]=0E[\varepsilon \mid X] = 0 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 yy on 20 regressors with 100 observations and an intercept, and in truth yy is independent of all of them. What is the expected R2R^2? What is the expected adjusted R2R^2? How many of the 20 coefficients do you expect to have ∣t∣>2|t| > 2?

Answer

Answer to Question 18.16.

The expected R2R^2 is 20/99≈0.2020/99 \approx 0.20, the expected adjusted R2R^2 is 0, and about one coefficient has ∣t∣>2|t| > 2.

Under the null, R2R^2 follows a Beta(p/2, (n−p−1)/2)(p/2,\ (n - p - 1)/2) distribution with mean p/(n−1)p/(n - 1). 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 1−(1−R2)(n−1)/(n−p−1)1 - (1 - R^2)(n - 1)/(n - p - 1) was built to average zero in this case.

Each tt-statistic has 79 degrees of freedom, and P(∣t∣>2)≈0.049P(|t| > 2) \approx 0.049, so the expected count is 20⋅0.049≈120 \cdot 0.049 \approx 1.

Why it matters. The in-sample R2R^2 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 ∣t∣>1.96|t| > 1.96, and what R2R^2 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 R2R^2 of about 0.240.24. With 1 000 steps, the share rises to about 93%, while R2R^2 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 tt-statistic has no limiting distribution. It grows like T\sqrt{T}: 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 ∣t∣>1.96|t| > 1.96 about 5% of the time, as it should, with R2R^2 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 p/n=0.4p/n = 0.4, 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 R2R^2 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 1.21.2 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 1.21.2?

Answer

Answer to Question 18.19.

The slope is 0.60.6, half of 1.21.2. Regressing on the current and several lagged market returns and summing the coefficients recovers 1.21.2, 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 1/21/2. So a fraction 1/21/2 of the move shows up the same day, a fraction 1/41/4 one day later, 1/81/8 two days later, and so on. Regressing on the market’s returns at several lags therefore gives slopes 0.60.6, 0.30.3, 0.150.15, and so on, and their sum is the true 1.21.2. Ignoring the lags leaves 0.60.6.

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 (31/32)/5(31/32)/5 of a week’s move does. So the slope is about 1.2 (1−31/160)≈0.971.2\,(1 - 31/160) \approx 0.97.

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 xx be standard normal and y=βx+∣x∣ εy = \beta x + |x|\,\varepsilon, with ε\varepsilon standard normal and independent of xx, so that the noise is large when ∣x∣|x| is large. With a large sample of size nn, 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 3/n\sqrt{3/n}, and the usual formula reports 1/n\sqrt{1/n}. So it understates the truth by a factor of 3≈1.73\sqrt3 \approx 1.73.

The slope error is ∑xiei/∑xi2\sum x_i e_i / \sum x_i^2, with ei=∣xi∣εie_i = |x_i|\varepsilon_i. With many observations, its variance is

E[x2e2]n (E[x2])2=E[x4]n=3n,\frac{E[x^2 e^2]}{n\,(E[x^2])^2} = \frac{E[x^4]}{n} = \frac{3}{n} ,

since E[x2e2]=E[x2⋅x2]E[ε2]E[x^2 e^2] = E[x^2 \cdot x^2]E[\varepsilon^2] and the fourth moment of a standard normal is 3. The usual formula is s2/∑xi2s^2/\sum x_i^2 with s2→E[e2]=E[x2]=1s^2 \to E[e^2] = E[x^2] = 1, so it gives 1/n1/n. It uses the average noise, and misses that the noise is largest exactly where xx has the most influence on the slope.

To fix the standard errors, use the White sandwich estimator: ∑xi2e^i2/∑xi2\sqrt{\sum x_i^2 \hat e_i^2}/\sum x_i^2 with demeaned xx. It estimates the 3/n3/n 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 1/xi21/x_i^2. In this case that makes the estimate the mean of yi/xiy_i/x_i, with variance 1/n1/n, a third of the OLS variance.

Follow-up. Each of your observations is the average of a different number mim_i of underlying data points. What weights do you use? mim_i, since the variance of an average is σ2/mi\sigma^2/m_i.

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 0.20.2 and 0.80.8, and a standard error of 0.8≈0.89\sqrt{0.8} \approx 0.89.

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 0.90.9?

Answer

Answer to Question 18.21.

The answers are (a) a factor of 1, so no understatement at all, (b) about 20≈4.47\sqrt{20} \approx 4.47, and (c) about 3.333.33.

The usual formula assumes that xtetx_t e_t is uncorrelated over time. In fact, the variance of the slope is larger by the factor

1+2∑k≥1ρx(k) ρe(k),1 + 2 \sum_{k \ge 1} \rho_x(k)\,\rho_e(k) ,

where ρx\rho_x and ρe\rho_e are the autocorrelations of the regressor and of the error. Two 20-day windows starting kk days apart share 20−k20 - k days, so ρe(k)=1−k/20\rho_e(k) = 1 - k/20 for k<20k < 20.

(a) If the signal is independent from day to day, ρx(k)=0\rho_x(k) = 0, the factor is 1. Overlap in yy alone does no harm to the slope’s standard error. Many candidates miss this.

(b) If the signal is nearly constant, ρx(k)≈1\rho_x(k) \approx 1, the factor is ∑∣k∣<20(1−∣k∣/20)=20\sum_{|k|<20}(1 - |k|/20) = 20, so the standard errors are too small by 20\sqrt{20}.

(c) With ρx(k)=0.9k\rho_x(k) = 0.9^k, the factor is 1+2∑k=1190.9k(1−k/20)≈11.11 + 2\sum_{k=1}^{19} 0.9^k(1 - k/20) \approx 11.1, whose square root is 3.333.33. 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 0.90.9, the factor is (1+0.81)/(1−0.81)=9.53(1 + 0.81)/(1 - 0.81) = 9.53, so the standard errors are too small by 3.093.09. The Durbin–Watson statistic, which is about 2(1−ρ)2(1 - \rho), is the quick check on the residuals.

Question 18.22 ★★★ QR, DS, QT • any • junior, experienced

yy has correlation 0.60.6 with x1x_1 and correlation 0.60.6 with x2x_2, but you do not know the correlation between x1x_1 and x2x_2. What values can the R2R^2 of the regression of yy on both take? Then a different case: x1x_1 is uncorrelated with yy, x2x_2 has correlation 0.40.4 with yy, and x1x_1 and x2x_2 have correlation 0.90.9. Is x1x_1 useless?

Answer

Answer to Question 18.22.

R2R^2 can take any value from 0.360.36 to 1. And no, x1x_1 is far from useless: with both regressors the R2R^2 is 0.8420.842, against 0.160.16 for x2x_2 alone.

For two regressors with correlations r1r_1, r2r_2 with yy and ρ\rho with each other,

R2=r12+r22−2r1r2ρ1−ρ2.R^2 = \frac{r_1^2 + r_2^2 - 2 r_1 r_2 \rho}{1 - \rho^2} .

With r1=r2=0.6r_1 = r_2 = 0.6 this is 0.72/(1+ρ)0.72/(1 + \rho). As ρ→1\rho \to 1, the two regressors are the same variable and R2→0.36R^2 \to 0.36. Lowering ρ\rho raises R2R^2. The correlation matrix of y,x1,x2y, x_1, x_2 must be positive semidefinite, which here requires ρ≥2⋅0.36−1=−0.28\rho \ge 2 \cdot 0.36 - 1 = -0.28. At that value R2=1R^2 = 1.

In the second case, with r1=0r_1 = 0, r2=0.4r_2 = 0.4 and ρ=0.9\rho = 0.9, R2=0.16/0.19≈0.842R^2 = 0.16/0.19 \approx 0.842. This is a suppressor variable: x1x_1 has no relation to yy directly, but it cancels the part of x2x_2 that is noise for predicting yy.

Classic wrong answer. “Joint R2R^2 is at most the sum of the separate R2R^2 values,” or “a variable with zero correlation with yy 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 0.050.05 with the next day’s return. What correlation can the best linear combination of them reach if their correlation with each other is 0.50.5, 00, or −0.5-0.5? In the case of 0.50.5, suppose the second signal’s correlation with the return is 0.020.02 and not 0.050.05. What sign should its weight have?

Answer

Answer to Question 18.23.

The best combination reaches 0.05770.0577, 0.07070.0707 and 0.10.1 in the three cases. With correlations 0.050.05 and 0.020.02 and ρ=0.5\rho = 0.5, the second signal’s weight is negative, even though it predicts positively by itself.

The best linear combination’s correlation with the target is R2\sqrt{R^2}, and the formula for two regressors gives R2=2r2/(1+ρ)R^2 = 2r^2/(1 + \rho) with equal correlations. For r=0.05r = 0.05:

ρ=0.5:0.0577,ρ=0:0.0707,ρ=−0.5:0.1.\rho = 0.5 : 0.0577, \qquad \rho = 0 : 0.0707, \qquad \rho = -0.5 : 0.1.

Diversification works: correlated signals add little, independent ones add as 2\sqrt2, and negatively correlated signals with the same sign of prediction add more.

The optimal weights are w∝Σ−1rw \propto \Sigma^{-1}r. With Σ=(10.50.51)\Sigma = \bigl(\begin{smallmatrix}1 & 0.5\\ 0.5 & 1\end{smallmatrix}\bigr) and r=(0.05,0.02)r = (0.05, 0.02),

w=10.75(0.05−0.5⋅0.02,  0.02−0.5⋅0.05)=(0.0533, −0.0067).w = \frac{1}{0.75}\bigl(0.05 - 0.5 \cdot 0.02,\ \ 0.02 - 0.5 \cdot 0.05\bigr) = (0.0533,\ -0.0067).

The second signal’s own correlation of 0.020.02 is less than the 0.0250.025 it would get just by being correlated with the first. So it is shorted against the first, which adds a little: the correlation is 0.05030.0503 against 0.050.05 alone.

Why it matters. This is the regression of return on signals, and it shows why combining beats selecting. The gain from 0.050.05 to 0.05770.0577 is modest but real: an annual Sharpe ratio of about 0.920.92, against 0.790.79. 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 x⊤x=1x^\top x = 1, and noise of variance σ2=1\sigma^2 = 1. The true coefficient is β=0.5\beta = 0.5. OLS gives β^\hat\beta, and ridge gives β^/(1+λ)\hat\beta/(1 + \lambda). Which λ\lambda 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 λ=σ2/β2=4\lambda = \sigma^2/\beta^2 = 4, which gives a mean squared error of 0.20.2 against 1 for OLS, an 80% reduction.

The ridge estimate β^/(1+λ)\hat\beta/(1 + \lambda) has bias −λβ/(1+λ)-\lambda\beta/(1 + \lambda) and variance σ2/(1+λ)2\sigma^2/(1 + \lambda)^2, so

MSE(λ)=σ2+λ2β2(1+λ)2.\mathrm{MSE}(\lambda) = \frac{\sigma^2 + \lambda^2\beta^2}{(1 + \lambda)^2}.

Setting the derivative to zero gives λ∗=σ2/β2\lambda^* = \sigma^2/\beta^2, and the minimum is σ2β2/(σ2+β2)\sigma^2\beta^2/(\sigma^2 + \beta^2). With σ=1\sigma = 1 and β=0.5\beta = 0.5, that is λ∗=4\lambda^* = 4 and MSE=0.2\mathrm{MSE} = 0.2. The estimate is β^/5\hat\beta/5: throw away four fifths of it.

The weaker the signal relative to noise, the more you should shrink. A signal with a true tt-statistic of 0.50.5 should be cut hard, while one with β=5\beta = 5 gets only λ∗=0.04\lambda^* = 0.04. Of course β\beta is unknown, which is why you choose λ\lambda 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 β∼N(0,τ2)\beta \sim N(0, \tau^2), the posterior mean is the ridge estimate with λ=σ2/τ2\lambda = \sigma^2/\tau^2. For τ2=0.25\tau^2 = 0.25 that again multiplies the estimate by 1/51/5.

Follow-up. And with many regressors? In the singular value basis, each direction is multiplied by d2/(d2+λ)d^2/(d^2 + \lambda), so the directions with little variance in XX are shrunk the most.

Question 18.25 ★★★ QR, QT, Risk, DS • any • junior, experienced

xx and yy are jointly normal with unit variance and correlation 0.50.5. You keep only the observations with x>0x > 0 and regress yy on xx. What slope and correlation do you get? What slope do you get if instead you keep only the observations with y>0y > 0?

Answer

Answer to Question 18.25.

Keeping x>0x > 0 leaves the slope at 0.50.5 and lowers the correlation to about 0.330.33. Keeping y>0y > 0 lowers the slope to about 0.220.22.

Selecting on xx leaves the relation intact: given xx, yy still has mean 0.5 x0.5\,x, so the slope remains 0.50.5. Only the spread of xx falls. The variance of a standard normal above zero is v=1−2/π≈0.363v = 1 - 2/\pi \approx 0.363. The correlation falls because the explained variance falls:

corr2=ρ2vρ2v+1−ρ2=0.25⋅0.3630.25⋅0.363+0.75≈0.108,corr≈0.33.\text{corr}^2 = \frac{\rho^2 v}{\rho^2 v + 1 - \rho^2} = \frac{0.25 \cdot 0.363}{0.25 \cdot 0.363 + 0.75} \approx 0.108, \quad \text{corr} \approx 0.33.

Selecting on yy breaks the relation, because now the noise matters: for low xx, you keep only the points with a large positive error. So the errors are no longer independent of xx, and the slope falls. Using the normal relation, with x=ρy+1−ρ2 zx = \rho y + \sqrt{1 - \rho^2}\,z and the same variance vv for yy above zero, you get Cov(x,y)=ρv\mathrm{Cov}(x,y) = \rho v and Var(x)=ρ2v+1−ρ2\mathrm{Var}(x) = \rho^2 v + 1 - \rho^2, so

slope=ρvρ2v+1−ρ2=0.5⋅0.3630.841≈0.216.\text{slope} = \frac{\rho v}{\rho^2 v + 1 - \rho^2} = \frac{0.5 \cdot 0.363}{0.841} \approx 0.216.

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 yy on xx with an intercept has 1 000 observations, where xx has mean 0 and ∑xi2=1000\sum x_i^2 = 1000. One observation has x=10x = 10 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 0.1010.101, removing it lowers the slope by about 0.0220.022, and its out-of-sample prediction error is about 2.222.22.

Leverage is the diagonal of the hat matrix, how much the observation’s own value moves its fitted value. With an intercept,

h=1n+(x−xˉ)2∑(xi−xˉ)2=11000+1001000=0.101.h = \frac1n + \frac{(x - \bar x)^2}{\sum (x_i - \bar x)^2} = \frac{1}{1000} + \frac{100}{1000} = 0.101.

The leverages sum to the number of coefficients, so the average here is 2/10002/1000, and this point has over 50 times that.

Deleting a point has exact formulas, so no refit is needed:

prediction error without it=e1−h=20.899≈2.22,\text{prediction error without it} = \frac{e}{1 - h} = \frac{2}{0.899} \approx 2.22,
slope change=(x−xˉ) e(1−h)∑(xi−xˉ)2=10⋅20.899⋅1000≈0.022.\text{slope change} = \frac{(x - \bar x)\,e}{(1 - h)\sum(x_i - \bar x)^2} = \frac{10 \cdot 2}{0.899 \cdot 1000} \approx 0.022.

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 1−hi1 - h_i.

Why it matters. One observation with large xx 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 xx 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 y=x+uy = x + u, and x=z+u+vx = z + u + v, where zz, uu and vv are independent with unit variance. So xx is correlated with the error uu. What slope does OLS of yy on xx give in a large sample? How do you use zz to get the true slope? What goes wrong if zz is only weakly related to xx?

Answer

Answer to Question 18.27.

OLS gives 4/34/3, not 1. The instrument gives Cov(z,y)/Cov(z,x)=1\mathrm{Cov}(z, y)/\mathrm{Cov}(z, x) = 1. A weak instrument gives a very wide estimate, biased towards OLS.

OLS has slope Cov(x,y)/Var(x)\mathrm{Cov}(x, y)/\mathrm{Var}(x). Here Var(x)=3\mathrm{Var}(x) = 3, and Cov(x,y)=Var(x)+Cov(x,u)=3+1=4\mathrm{Cov}(x, y) = \mathrm{Var}(x) + \mathrm{Cov}(x, u) = 3 + 1 = 4, so 4/34/3: xx and the error move together, and the regression gives xx the credit.

The variable zz is an instrument: it moves xx, and it has no other route to yy. Then Cov(z,y)=β Cov(z,x)\mathrm{Cov}(z, y) = \beta\,\mathrm{Cov}(z, x), since zz is uncorrelated with uu. So β=Cov(z,y)/Cov(z,x)=1/1=1\beta = \mathrm{Cov}(z, y)/\mathrm{Cov}(z, x) = 1/1 = 1. Two-stage least squares gives the same number: regress xx on zz, then yy 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 x=0.1 z+u+vx = 0.1\,z + u + v 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 R2R^2 of the best linear predictor is 1%. Roughly what R2R^2 should you expect out of sample, measured against predicting the true mean? How much data would you need for the out-of-sample R2R^2 to reach zero?

Answer

Answer to Question 18.28.

Expect about −1%-1\%, a negative number. You need about 1 980 observations before the out-of-sample R2R^2 reaches zero.

With pp estimated coefficients and nn 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 (1+p/n)(1 + p/n). With a total variance of 1, the noise variance is 1−R21 - R^2, so

Roos2≈R2−pn(1−R2)=0.01−0.02⋅0.99≈−0.0098.R^2_{\text{oos}} \approx R^2 - \frac{p}{n}(1 - R^2) = 0.01 - 0.02 \cdot 0.99 \approx -0.0098 .

The in-sample R2R^2 of the same fit is about 3%, since it adds p/np/n rather than subtracting it. Setting the out-of-sample figure to zero gives n≈p(1−R2)/R2=1980n \approx p(1 - R^2)/R^2 = 1980. 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 pp or to shrink: ridge costs a little bias and removes a large part of the p/np/n term.

Question 18.29 ★★★★ QR, QT • hedge fund • experienced

Consider rt+1=βxt+ut+1r_{t+1} = \beta x_t + u_{t+1} and xt+1=ρxt+vt+1x_{t+1} = \rho x_t + v_{t+1}, where β=0\beta = 0, ρ=0.95\rho = 0.95, the shocks uu and vv have unit variance and correlation −0.9-0.9, and you have 120 observations. You regress rt+1r_{t+1} on xtx_t with an intercept. Roughly what is the mean of the estimated slope? You test β=0\beta = 0 against β>0\beta > 0 with the usual tt-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 +0.03+0.03, 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 xtx_t is uncorrelated with the next shock, but it is not exogenous: it depends on past values of uu through vv. Write ut=γvt+wtu_t = \gamma v_t + w_t, with ww independent of vv and γ=Cov(u,v)/Var(v)=−0.9\gamma = \mathrm{Cov}(u, v)/\mathrm{Var}(v) = -0.9. The slope of vt+1v_{t+1} on xtx_t is exactly ρ^−ρ\hat\rho - \rho, so

β^−β=γ(ρ^−ρ)+(slope on w),\hat\beta - \beta = \gamma(\hat\rho - \rho) + (\text{slope on } w),

and the last term has mean zero.

So the error in β^\hat\beta is the error in the persistence estimate, multiplied by γ\gamma. Persistence is underestimated in short samples: the standard approximation is E[ρ^−ρ]≈−(1+3ρ)/T=−3.85/120≈−0.032E[\hat\rho - \rho] \approx -(1 + 3\rho)/T = -3.85/120 \approx -0.032. So E[β^]≈(−0.9)(−0.032)≈0.029E[\hat\beta] \approx (-0.9)(-0.032) \approx 0.029. A seeded simulation gives a mean slope of 0.0320.032, a bias in ρ^\hat\rho of −0.035-0.035, and a mean tt-statistic of about 0.70.7. The test rejects about 16% of the time. You can size this at the board. With Var(x)=1/(1−ρ2)≈10.3\mathrm{Var}(x) = 1/(1 - \rho^2) \approx 10.3, the standard error is at least about 1/(3.2120)≈0.0291/(3.2\sqrt{120}) \approx 0.029, as large as the bias, so the tt-statistic shifts up by at most about 1. On a normal approximation, a shift of 0.70.7 to 1 moves the rejection rate from 5% to between 17%17\% and 26%26\%. 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 γ\gamma 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 γ(ρ^−ρ)\gamma(\hat\rho - \rho), 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 ρ=0.95\rho = 0.95 the true half-life is 13.513.5 periods. The mean estimate on 120 points, ρ^≈0.915\hat\rho \approx 0.915, implies 7.87.8.

Question 18.30 ★★★★ QR, QT, DS • hedge fund, bank • experienced

y=x1+εy = x_1 + \varepsilon, so only x1x_1 matters. You observe w=x1+nw = x_1 + n, a noisy version of x1x_1 with noise variance 0.50.5, along with a second variable x2x_2. Both x1x_1 and x2x_2 have unit variance, and their correlation is 0.80.8, and x2x_2 has no effect on yy once x1x_1 is known. You regress yy on ww and x2x_2. What coefficients do you get in a large sample? What would you conclude about x2x_2, and what is the error?

Answer

Answer to Question 18.30.

The coefficients are about 0.420.42 on ww and about 0.470.47 on x2x_2. You would conclude that x2x_2 has a strong effect, and that is false. Its coefficient only reflects the noise in ww.

Solve the normal equations in the population. Let ρ=0.8\rho = 0.8 and s2=0.5s^2 = 0.5. Then Var(w)=1+s2\mathrm{Var}(w) = 1 + s^2, Cov(w,x2)=ρ\mathrm{Cov}(w, x_2) = \rho, Cov(w,y)=1\mathrm{Cov}(w, y) = 1 and Cov(x2,y)=ρ\mathrm{Cov}(x_2, y) = \rho, which gives

(1+s2ρρ1)(b1b2)=(1ρ).\begin{pmatrix} 1 + s^2 & \rho \\ \rho & 1 \end{pmatrix}\begin{pmatrix} b_1 \\ b_2 \end{pmatrix} = \begin{pmatrix} 1 \\ \rho \end{pmatrix}.

The solution is

b1=1−ρ21+s2−ρ2=0.360.86≈0.42,b2=ρ s21+s2−ρ2=0.40.86≈0.47.b_1 = \frac{1 - \rho^2}{1 + s^2 - \rho^2} = \frac{0.36}{0.86} \approx 0.42, \qquad b_2 = \frac{\rho\,s^2}{1 + s^2 - \rho^2} = \frac{0.4}{0.86} \approx 0.47.

When s2=0s^2 = 0 the coefficient on x2x_2 is zero, as it should be. As s2s^2 grows, the regression trusts ww less and leans on x2x_2, because x2x_2 is a clean proxy for x1x_1. In the limit, b2b_2 goes to ρ=0.8\rho = 0.8, the coefficient of yy on x2x_2 alone.

More data does not help. The bias stays while the standard error shrinks, so the tt-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.