beta_and_alpha_full_stats
- qf_lib.common.utils.returns.beta_and_alpha.beta_and_alpha_full_stats(strategy_tms: QFSeries, benchmark_tms: QFSeries) Tuple[float, float, float] [source]
Calculates alpha and beta of the series versus the benchmark series.
- Parameters:
- Returns:
(beta, alpga, r_value)
beta - beta coefficient for the linear fit
alpha - alpha coefficient for the linear fit (y = alpha * x + beta, where x is the benchmark return and y is the portfolio’s return)
r_value - correlation coefficient. NOTE: this is not r_squared, r_squared = r_value**2
- Return type:
Tuple[float, float, float]