qis.compute_ar_unsmoothed_prices¶
- qis.compute_ar_unsmoothed_prices(prices, ar_order=2, freq='QE', span=40, mean_adj_type=MeanAdjType.EWMA, warmup_period=8, max_value_for_beta=0.75, min_value_for_beta=-0.25, apply_ewma_mean_smoother=True, non_negative=False, non_negative_tol=0.0, is_log_returns=True, insufficient_data=InsufficientData.NAN)[source]¶
Apply rolling EWMA AR(q) unsmoothing to a price panel, optionally mixed-frequency.
Converts prices to returns at the specified frequency (or per-asset frequencies), applies
adjust_returns_with_ar, converts back to NAVs.- Parameters:
prices (DataFrame) – Price level DataFrame.
ar_order (int) – Lag order q (1 = AR(1); 2 = AR(2); q > 2 ok).
freq (str | Series) – Either a single pandas resample frequency string applied to all assets, or a Series mapping asset name to frequency for mixed-frequency panels (e.g. monthly HFs alongside quarterly PE).
span (int) – EWMA span for the rolling beta.
mean_adj_type (MeanAdjType) – Mean adjustment type for beta regression.
warmup_period (int | None) – Initial warmup periods to mask.
max_value_for_beta (float | None) – Upper bound on theta_sum (default 0.75).
min_value_for_beta (float | None) – Lower bound on theta_sum (default -0.25). See
adjust_returns_with_arfor the rationale behind clipping the sum.apply_ewma_mean_smoother (bool) – If True, second EWMA pass on the beta series (forwarded to
adjust_returns_with_ar).is_log_returns (bool) – If True, use log returns for the regression and convert back with expm1 at the end. Generally recommended for unsmoothing.
insufficient_data (InsufficientData) – Forwarded to
adjust_returns_with_ar. Default NAN.non_negative (bool)
non_negative_tol (float)
- Returns:
Tuple (navs, unsmoothed_returns, betas, r2).
- Return type: