Skip to content

fix: chain add_stage past two stages - #317

Merged
MamadouSDiallo merged 5 commits into
mainfrom
fix/add-stage-three-stages
Oct 16, 2026
Merged

MamadouSDiallo merged 5 commits into
mainfrom
fix/add-stage-three-stages

Conversation

@MamadouSDiallo

Copy link
Copy Markdown
Contributor

A third add_stage raised DuplicateError on svy_prob_selection_stage1.

  • Stage k keeps svy_prob_selection_stage{k} / svy_sample_weight_stage{k}; hits and certainty get _stage{k}; overall probability = product of the stages.
  • The next stage joins on its Design psu, matched to the same-named column of the current sample, else the stage-1 PSU. It used to always join on the stage-1 PSU, which duplicated rows past stage two.
  • Raises with guidance when the link matches several rows (e.g. a bare frame at stage three), or when add_stage is called before selecting the added stage.
  • Combined design unchanged: stage-1 stratum/psu, ssu=None.

Unblocks one-call multistage selection (S5); does not implement it.

Stage k columns are numbered from the existing ones and the overall probability is the product of every stage's. The next stage links on its psu in the current sample; a link matching several rows raises.
…tages

# Conflicts:
#	packages/svy/CHANGELOG.md
@MamadouSDiallo
MamadouSDiallo merged commit dfb4398 into main Oct 16, 2026
12 checks passed
@MamadouSDiallo
MamadouSDiallo deleted the fix/add-stage-three-stages branch October 16, 2026 20:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant