Skip to Content

lacuna.regime

Regime classification and per-regime analysis.

Generated from Lacuna 0.14.3. For what these do and when to use them, read the guide.

Functions

quantile_regimes

def quantile_regimes(
    data: object,
    *,
    time: str = 'time',
    value: str = 'value',
    method: QuantileMethod = 'expanding',
    lower_quantile: float = 0.25,
    upper_quantile: float = 0.75,
    min_history: int = 20,
    window: int | None = None,
    lower_threshold: float | None = None,
    upper_threshold: float | None = None,
    low_label: str = 'low',
    middle_label: str = 'middle',
    high_label: str = 'high',
    unknown_label: str = 'unknown',
    available_time: str | None = None,
) -> AnalysisResult

Classify a scalar with fixed, trailing expanding/rolling, or retrospective quantiles.

regime_analysis

def regime_analysis(
    data: object,
    *,
    time: str = 'time',
    regime: str = 'regime',
    outcome: str = 'outcome',
    classification_mode: ClassificationMode,
    available_time: str | None = None,
    mutually_exclusive: bool = True,
    unknown_label: str = 'unknown',
    min_observations: int = 20,
    annualization: float = 1.0,
    concentration_threshold: float = 0.6,
) -> AnalysisResult

Summarize conditional outcomes and quantify regime dependence and concentration.

Types and constants

ClassificationMode

ClassificationMode = Literal['point_in_time', 'retrospective']

QuantileMethod

QuantileMethod = Literal['fixed', 'expanding', 'rolling', 'retrospective']