beta_and_alpha_full_stats¶
-
qf_lib.common.utils.returns.beta_and_alpha.
beta_and_alpha_full_stats
(strategy_tms: qf_lib.containers.series.qf_series.QFSeries, benchmark_tms: qf_lib.containers.series.qf_series.QFSeries) → Tuple[float, float, float, float, float][source]¶ Calculates alpha and beta of the series versus the benchmark series.
- Parameters
- Returns
(beta, alpga, r_value, p_value, std_err)
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
p_value - two-sided p-value for a hypothesis test whose null hypothesis is that the slope is zero
std_err - standard error of the estimate
- Return type
Tuple[float, float, float, float, float]