Normalize one-point regression residual volatility
This commit is contained in:
@@ -309,7 +309,10 @@ def run_factor_regression(
|
||||
fitted = x @ coefficients
|
||||
residuals = y.to_numpy() - fitted
|
||||
residual_series = pd.Series(residuals, index=regression_frame.index)
|
||||
residual_vol_ann = float(residual_series.std(ddof=1) * np.sqrt(TRADING_DAYS_PER_YEAR))
|
||||
if len(residual_series) == 1:
|
||||
residual_vol_ann = 0.0
|
||||
else:
|
||||
residual_vol_ann = float(residual_series.std(ddof=1) * np.sqrt(TRADING_DAYS_PER_YEAR))
|
||||
|
||||
dof = n_obs - param_count
|
||||
if dof > 0:
|
||||
|
||||
Reference in New Issue
Block a user