qis.compute_ra_perf_table_with_benchmark¶
- qis.compute_ra_perf_table_with_benchmark(prices, benchmark=None, benchmark_price=None, perf_params=None, is_log_returns=False, drop_benchmark=False, **kwargs)[source]¶
Compute the risk-adjusted performance table augmented with alpha/beta to a benchmark.
Extends
compute_ra_perf_tableby regressing each asset’s returns on the benchmark and appending alpha (raw and annualised), beta, R² and the p-value of alpha.- Parameters:
prices (DataFrame) – DataFrame of asset price levels.
benchmark (str) – Non-empty benchmark column name. Optional if a named
benchmark_priceis supplied. The resolved name must occur at most once inprices.benchmark_price (Series) – Stand-alone benchmark price Series. Optional if
benchmarkis inprices. Its name must be a non-empty string whenbenchmarkis omitted. Seeresolve_benchmark_sourcefor the three-way branching.perf_params (PerfParams) – Performance parameter object. If None, it is
PerfParams(freq=pd.infer_freq(prices.index)), which setsfreq_regas well asfreq_volto the inferred index frequency: a regular business-day index regresses daily returns (freq_reg='B'), not the quarterlyPerfParams()defaultfreq_reg='QE'; an irregular index falls back to the defaults.is_log_returns (bool) – If True, compute log returns instead of arithmetic returns for the regression.
drop_benchmark (bool) – If True, exclude the benchmark row from the output table.
**kwargs – Reserved for forward compatibility; currently unused.
- Returns:
DataFrame indexed by asset with all base RA metrics plus ALPHA, ALPHA_AN, BETA, R2 and ALPHA_PVALUE columns. Each regression uses only the asset and benchmark’s joint sampled observed support; another column’s later dates do not extend that sample.
- Raises:
ValueError – If the benchmark source has no non-empty string label, the selected label is duplicated in prices, or no usable benchmark source is available.
- Return type: