svy
v0.24.1Design-based survey analysis: estimation, weighting, replicate weights, and modelling.
Open source · free forever
The open-source engine under svyLab: estimation with correct variances, weighting and calibration, replicate weights, small-area estimation, and readers for SPSS, Stata, and SAS files — validated against R's survey package. Read the code, run it in a notebook, cite it.
import svy df = svy.read_parquet("wave1.parquet") design = svy.Design( stratum="region", psu="cluster", wgt="final_wgt" ) sample = svy.Sample(data=df, design=design) est = sample.estimation.mean( ["income", "food_share"], by="urban_rural" ) print(est) # est · se · lci · uci · cv · deff · df
Prefer to try it first? Open the playground →
Documentation
All on PyPI · github.com/samplics-org
Design-based survey analysis: estimation, weighting, replicate weights, and modelling.
Small-area estimation: Fay–Herriot, unit-level (Battese–Harter–Fuller), Molina–Rao — on JAX.
Fast readers and writers for SPSS, Stata, and SAS survey files — labels and missing codes included.
If you read four things
The standing validation study — every estimate and standard error agrees to at least six decimals.
12–24× faster than R's survey on a one-million-row stratified two-stage design.
The weighting tutorial — the page most people arrive on from search.
Variance estimation with replicate weights, end to end.
Learn
Validation studies, benchmarks, comparisons with R and Stata — the methods content.
svy on national surveys — Mexico's ENIGH, Brazil's TIC Domicílios, and more.
Hands-on sessions on public-use files, such as the 2025 MEPS-HC workshop.
Everything, including the RSS feeds: svylab.com/learn →
svy is the evolution of samplics, published in the Journal of Open Source Software. If it contributes to published work, please cite:
Diallo, M. S. (2021). samplics: a Python package for selecting, weighting and analyzing data from complex sampling designs. Journal of Open Source Software. doi:10.21105/joss.03376
Issues, feature requests, and pull requests are welcome on GitHub. The comparison with R doubles as the validation suite, so a reproducible example against R's survey is the most useful bug report there is.
Open an issue →Releases, tutorials, and svyLab updates — a few emails a year.
Using svy in your organization?
Questionnaire and analysis plan in — weights, estimates, and a branded report out, every wave, with the method behind every number visible to a reviewer. Same engine; one governed place.