Skip to content

designweights

Design-based survey estimation with weights as the interface.

designweights is a Python library for estimating finite-population parameters from survey data. It is built for survey methodologists at national statistical offices and research organizations, and for anyone who needs design-based inference they can read, check, and trust.

Version 0

The library is pre-alpha. The current API is a seed for review, not a stable surface. The roadmap describes what lands next.

The idea in one line

An estimator is a function of the data and a weight vector; everything else (design, nonresponse, calibration, variance) works by transforming the weights.

Quickstart

import designweights as dw

total = dw.total(y, weights=w)  # expansion (Horvitz-Thompson) total
mean = dw.mean(y, weights=w)  # Hajek mean
rate = dw.ratio(y, x, weights=w)  # ratio of totals

Install from source while the library is pre-release:

pip install git+https://github.com/hananather/designweights

Why another survey library

The R ecosystem gives methodologists survey, svrep, and sampling. Python has no equivalent with the same design-based rigor and a modern engineering footing. designweights aims to be that library: plain functions over NumPy arrays, formulas that read against the literature, exactness proven by tests, and clean composition with pandas and scikit-learn.

Start with the design principles, then the API reference.