Sensitivity API

class qca.ThresholdSweep(source, *, outcome=None, conditions=None, case_id=None)[source]

ThSQCA-style threshold sweep facade for PyQCA models or data frames.

Parameters:
  • source (QCAEngineBase | pd.DataFrame)

  • outcome (str | None)

  • conditions (Sequence[str] | None)

  • case_id (str | None)

outcome(thresholds, *, condition_thresholds=None, thrX=None, pre_calibrated=None, include='', dir_exp=None, incl_cut=0.8, n_cut=1, pri_cut=0.0, minimizer='standard', coverage_cutoff=None)[source]

OTS-QCA: sweep outcome thresholds while X thresholds are fixed.

Parameters:
  • thresholds (Sequence[float])

  • condition_thresholds (Mapping[str, float] | None)

  • thrX (Mapping[str, float] | None)

  • pre_calibrated (Sequence[str] | None)

  • include (str)

  • dir_exp (Mapping[str, Any] | Sequence[Any] | Any | None)

  • incl_cut (float)

  • n_cut (int)

  • pri_cut (float)

  • minimizer (str)

  • coverage_cutoff (float | None)

Return type:

ThresholdSweepResult

condition(condition, thresholds, *, outcome_threshold, condition_thresholds=None, default_condition_threshold=0.5, pre_calibrated=None, include='', dir_exp=None, incl_cut=0.8, n_cut=1, pri_cut=0.0, minimizer='standard', coverage_cutoff=None)[source]

CTS-QCA: sweep one condition threshold.

Parameters:
  • condition (str)

  • thresholds (Sequence[float])

  • outcome_threshold (float)

  • condition_thresholds (Mapping[str, float] | None)

  • default_condition_threshold (float)

  • pre_calibrated (Sequence[str] | None)

  • include (str)

  • dir_exp (Mapping[str, Any] | Sequence[Any] | Any | None)

  • incl_cut (float)

  • n_cut (int)

  • pri_cut (float)

  • minimizer (str)

  • coverage_cutoff (float | None)

Return type:

ThresholdSweepResult

multi_condition(threshold_grid, *, outcome_threshold, pre_calibrated=None, include='', dir_exp=None, incl_cut=0.8, n_cut=1, pri_cut=0.0, minimizer='standard', coverage_cutoff=None)[source]

MCTS-QCA: sweep a grid of condition thresholds.

Parameters:
  • threshold_grid (Mapping[str, Sequence[float]])

  • outcome_threshold (float)

  • pre_calibrated (Sequence[str] | None)

  • include (str)

  • dir_exp (Mapping[str, Any] | Sequence[Any] | Any | None)

  • incl_cut (float)

  • n_cut (int)

  • pri_cut (float)

  • minimizer (str)

  • coverage_cutoff (float | None)

Return type:

ThresholdSweepResult

dual(threshold_grid, outcome_thresholds, *, pre_calibrated=None, include='', dir_exp=None, incl_cut=0.8, n_cut=1, pri_cut=0.0, minimizer='standard', coverage_cutoff=None)[source]

DTS-QCA: sweep condition and outcome thresholds jointly.

Parameters:
  • threshold_grid (Mapping[str, Sequence[float]])

  • outcome_thresholds (Sequence[float])

  • pre_calibrated (Sequence[str] | None)

  • include (str)

  • dir_exp (Mapping[str, Any] | Sequence[Any] | Any | None)

  • incl_cut (float)

  • n_cut (int)

  • pri_cut (float)

  • minimizer (str)

  • coverage_cutoff (float | None)

Return type:

ThresholdSweepResult

fuzzy_anchors(condition, anchor_grid, **kwargs)[source]

Run fsQCA anchor-sensitivity analysis for one raw condition.

Parameters:
  • condition (str)

  • anchor_grid (Mapping[str, Sequence[float]])

  • kwargs (Any)

class qca.ThresholdSweepResult(sweep_type, summary_df, settings, results=<factory>, details=<factory>)[source]

Result object returned by ThresholdSweep methods.

Parameters:
  • sweep_type (str)

  • summary_df (DataFrame)

  • settings (dict[str, Any])

  • results (list[QCAFitResult | None])

  • details (list[dict[str, Any]])

property solutions: DataFrame

Alias for the cross-threshold summary table.

property truth_tables: dict[str, DataFrame]

Truth tables keyed by threshold label.

property stability: dict[str, Any]

Simple cross-threshold stability summary.

summary()[source]

Return the cross-threshold summary table.

Return type:

DataFrame

to_markdown(path=None)[source]

Render a Markdown summary and optionally write it to disk.

Parameters:

path (str | Path | None)

Return type:

str

plot_heatmap(metric='consistency')[source]

Plot a threshold heatmap. Requires optional matplotlib.

Parameters:

metric (str)

plot_trajectory(metric='consistency')[source]

Plot metric trajectories across threshold settings.

Parameters:

metric (str)

class qca.AnchorSensitivity(source, *, outcome=None, conditions=None, case_id=None)[source]

fsQCA anchor-sensitivity facade for calibrated-set workflows.

Parameters:
  • source (pd.DataFrame | Any)

  • outcome (str | None)

  • conditions (Sequence[str] | None)

  • case_id (str | None)

full_membership(condition, values, *, full_out, crossover, **kwargs)[source]

Sweep full-membership anchors while other anchors are fixed.

Parameters:
  • condition (str)

  • values (Sequence[float])

  • full_out (float)

  • crossover (float)

  • kwargs (Any)

Return type:

AnchorSensitivityResult

crossover(condition, values, *, full_out, full_in, **kwargs)[source]

Sweep crossover anchors while full-out/full-in are fixed.

Parameters:
  • condition (str)

  • values (Sequence[float])

  • full_out (float)

  • full_in (float)

  • kwargs (Any)

Return type:

AnchorSensitivityResult

full_nonmembership(condition, values, *, crossover, full_in, **kwargs)[source]

Sweep full non-membership anchors while other anchors are fixed.

Parameters:
  • condition (str)

  • values (Sequence[float])

  • crossover (float)

  • full_in (float)

  • kwargs (Any)

Return type:

AnchorSensitivityResult

grid(condition, anchor_grid, *, sweep_type='multi_anchor', out_col=None, include='', dir_exp=None, incl_cut=0.75, n_cut=1, pri_cut=0.0, minimizer='standard', outcome_threshold=0.75, coverage_cutoff=None)[source]

Run a full three-anchor grid analysis for one raw condition.

Parameters:
  • condition (str)

  • anchor_grid (Mapping[str, Sequence[float]])

  • sweep_type (str)

  • out_col (str | None)

  • include (str)

  • dir_exp (Mapping[str, Any] | Sequence[Any] | Any | None)

  • incl_cut (float)

  • n_cut (int)

  • pri_cut (float)

  • minimizer (str)

  • outcome_threshold (float)

  • coverage_cutoff (float | None)

Return type:

AnchorSensitivityResult

class qca.AnchorSensitivityResult(sweep_type, summary_df, settings, results=<factory>, details=<factory>)[source]

Result object returned by fsQCA anchor-sensitivity sweeps.

Parameters:
  • sweep_type (str)

  • summary_df (DataFrame)

  • settings (dict[str, Any])

  • results (list[QCAFitResult | None])

  • details (list[dict[str, Any]])

property solutions: DataFrame

Alias for the cross-anchor summary table.

property calibrated_frames: dict[str, DataFrame]

Calibrated data frames keyed by run label.

property stability: dict[str, Any]

Cross-anchor calibration and solution stability summary.

summary()[source]

Return the cross-anchor summary table.

Return type:

DataFrame

to_markdown(path=None)[source]

Render a Markdown stability report and optionally write it to disk.

Parameters:

path (str | Path | None)

Return type:

str

plot_heatmap(metric='consistency', *, x='crossover', y='full_in')[source]

Plot a two-anchor heatmap. Requires optional matplotlib.

Parameters:
  • metric (str)

  • x (str)

  • y (str)

plot_trajectory(metric='consistency', *, x=None)[source]

Plot metric trajectories across anchor settings.

Parameters:
  • metric (str)

  • x (str | None)