Add robustness and sensitivity analysis - #15
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Sweeps the analytical choices a QCA result is conditional on, and reports which paths survive.
All four axes from the plan are covered: consistency, PRI and frequency cutoffs through
robustness_analysis, and calibration anchors throughcalibration_robustness, which recalibrates from raw measures for each anchor combination.Failures are recorded, not dropped
A specification that produces no solution gets a row with a
failuremessage andNaNfit rather than vanishing. "The model collapses above 0.9" is a finding, and silently omitting those rows would make the survivors look more robust than they are.Four similarity scales
Textual identity is the strictest comparison and often the least informative.
solution_similarityalso reports term overlap, configurational overlap over the literals used, and a fuzzy Jaccard over case membership. The last catches agreement the text hides:AandA+A*Bare textually different and select exactly the same cases, scoring 1.0 on membership — there is a test for precisely that.The framework refuses to overclaim
A stable path is stable, not true. Stability says the finding does not depend on one arbitrary cutoff; it says nothing about causal relevance, calibration sensibility, case selection, or omitted conditions. A mis-specified model can be perfectly stable, because sweeping cutoffs cannot detect a problem that lives in the model. The module docstring, the guide and the printed report all say so, and a test asserts the report keeps saying so.
Notes
Two report branches depend on the sweep happening to produce a disappearing or emerging term, so they are pinned against hand-built analyses rather than left to chance — as is the all-stable case where the report should stay quiet.
434 tests at 100% coverage; mypy strict and docs build clean.
Summary by cubic
Adds robustness and sensitivity analysis for QCA by sweeping consistency/PRI/frequency thresholds and calibration anchors, then reporting which solution terms persist across specifications. Also adds solution similarity measures, records failing specs, and includes a new guide.
RobustnessGridto sweep consistency, PRI, frequency; optional anchors for calibration sweeps.robustness_analysisfor threshold sweeps on calibrated data; returnsRobustnessAnalysis.calibration_robustnessrecalibrates from raw data per anchor combo (outcome_anchors,base_anchors).stable_terms,fragile_terms,disappearing_terms,emerging_terms(threshold adjustable).solution_similaritywith identity, term overlap, configurational, and membership comparisons.failuremessage and NaN fit;to_frame()exports all runs.conservative,parsimonious, andintermediate(needs expectations) solution families.RobustnessGrid,RobustnessAnalysis,robustness_analysis,calibration_robustness, andsolution_similarityfrom package root; added guideguide/robustness.md.Written for commit 65fd74b. Summary will update on new commits.