CONTENTS

Exercise: Stock Beta via OLS — Numerical Example

Problem

You have two years of daily returns (T=504T = 504 days) for a stock ss and an index mm. The true data-generating process is rs,t=0.0001+1.3rm,t+ϵtr_{s,t} = 0.0001 + 1.3\cdot r_{m,t} + \epsilon_t, with ϵtN(0,0.012)\epsilon_t \sim \mathcal{N}(0, 0.01^2) (stock-specific noise) and rm,tN(0.0005,0.0122)r_{m,t} \sim \mathcal{N}(0.0005, 0.012^2) (market returns).

  1. Simulate the data with a seeded RNG.

  2. Estimate α^\hat\alpha and β^\hat\beta using the closed-form OLS formulas from Exercise 1. Compare to the true values.
  3. Compute the standard error SE(β^)=σ/(rm,trˉm)2\text{SE}(\hat\beta) = \sigma/\sqrt{\sum(r_{m,t} - \bar r_m)^2} (using the true σ=0.01\sigma = 0.01, or use residual σ^\hat\sigma for a real-world estimate). Report a 95% confidence interval for β^\hat\beta.

  4. Interpret. Is your estimate statistically significantly different from the reference "market beta" of 1.01.0? From the "true" beta of 1.31.3? What is the minimum sample size TT you would need to distinguish a beta of 1.31.3 from 1.01.0 at 5% significance?

Hint

For part 3: the "residual σ^\hat\sigma" is σ^=RSS/(T2)\hat\sigma = \sqrt{\text{RSS}/(T - 2)}, which estimates noise std from the regression residuals. Use np.polyfit(..., full=True) to get residuals or compute manually.
Jump to the solution when you're ready.