pub fn calculate_beta(
df: &DataFrame,
price_column: &str,
market_column: &str,
window: usize,
) -> PolarsResult<Series>
Expand description
Calculates Beta - regression coefficient between two series
§Arguments
df
- DataFrame containing the price dataprice_column
- Column name for the price series (default “close”)market_column
- Column name for the market/benchmark serieswindow
- Window size for the calculation (typically 5)
§Returns
Returns a PolarsResult containing the Beta Series