Sequential Poisson sampling for Python.
Project description
Sequential Poisson sampling
Sequential Poisson sampling is a variation of Poisson sampling for drawing probability-proportional-to-size samples with a given number of units, and is commonly used for price-index surveys. This package is a Python implementation of the {sps} R package.
Installation
Install the stable release from PyPI
python -m pip install pysps
or get the development version from github
python -m pip install git+https://github.com/marberts/pysps.git
Usage
The first step to draw a sample is to construct the inclusion probabilties for each unit in the population.
>>> import pysps
>>> pi = pysps.InclusionProb([1, 2, 3, 4], 3)
>>> pi
InclusionProb(array([0.33333333, 0.66666667, 1. , 1. ]), 3)
Now these inclusion probabilities can be used to create a sample.
>>> samp = pysps.OrderSample(pi)
>>> samp.units
array([1, 2, 3])
>>> samp.weights
array([1.5, 1.0, 1.0])
Citation
If you use this software, please cite it
@software{pysps,
author = {Martin, Steve},
doi = {10.5281/zenodo.15825865},
license = {MIT},
title = {{pysps: Sequential Poisson sampling}},
version = {0.1.1},
year = {2025}
}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pysps-0.1.1.tar.gz.
File metadata
- Download URL: pysps-0.1.1.tar.gz
- Upload date:
- Size: 7.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a13a13505a608e5e06efe57c4ad0cd1b0cabda4275a02b085a5ed12cf7fb4ddd
|
|
| MD5 |
ebb082ef941991a5df9c9d84afddf39d
|
|
| BLAKE2b-256 |
354ed965c6271b07da212e120fc18914a1876f1535378aafcb13aac24f703f5c
|
File details
Details for the file pysps-0.1.1-py3-none-any.whl.
File metadata
- Download URL: pysps-0.1.1-py3-none-any.whl
- Upload date:
- Size: 7.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2b52813c8493a754d5efa4291d338522850fe32a6d287e85f6f05d7a97bddbab
|
|
| MD5 |
ad6e00aeed8fd759fb69432b5ff1ea48
|
|
| BLAKE2b-256 |
ce267ec1d2dc3145aa5453bfa40725765ade8bdee8fb322dfd524415f806ac33
|