The hardware and bandwidth for this mirror is donated by METANET, the Webhosting and Full Service-Cloud Provider.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]metanet.ch.

weightflow: Weighting Probability and Non-Probability Survey Samples with Recipe-Aware Replicate Variances

Builds survey analysis weights by declaring the whole weighting process as an ordered recipe of explicit adjustments, estimated in a single call: unknown eligibility, within-cluster selection, two-phase subsampling, nonresponse by weighting classes or response-propensity models, calibration and trimming. Calibration to known totals runs on linear, raking or logit distances, bounded, ridge-penalized, model-assisted or integrative with one weight per cluster; a calibrated trim bounds the weights while keeping the control totals exact. Non-probability samples are weighted against a probability reference sample by pseudo-weighting, mass imputation and doubly robust estimators that calibrate a single weight on the fitted values of several working models and on the population totals of the auxiliaries at once, so one multipurpose weight serves many variables. Variances come from a recipe-aware bootstrap and jackknife that re-apply the entire cascade on each replicate, so every adjustment is inside the variance instead of being treated as fixed; across panel waves the replicates are coordinated by carrying forward the selection multiplicities of the sampling units, so the sample overlap enters the variance of a net change as covariance. Rotating and pure panels add attrition, longitudinal weights, gross flows and composite estimation, a self-contained HTML report documents each step, and the weights bridge to the 'survey' and 'srvyr' packages, which are optional: the package itself runs on base R. The methods, and the simulation evidence behind the variance estimators, are described in Ferreira (2026) <doi:10.1177/18747655261484262>.

Version: 1.3.1
Depends: R (≥ 4.1.0)
Imports: stats, utils, graphics, parallel
Suggests: MASS, rpart, ranger, testthat (≥ 3.0.0), survey, srvyr, dplyr, tidyr, ggplot2, haven, archive, knitr, rmarkdown, spelling, xgboost, yaml
Published: 2026-10-16
DOI: 10.32614/CRAN.package.weightflow
Author: Juan Pablo Ferreira ORCID iD [aut, cre], Andrés Gutiérrez ORCID iD [aut]
Maintainer: Juan Pablo Ferreira <juanpablo.ferreira at fcea.edu.uy>
BugReports: https://github.com/jpferreira33/weightflow/issues
License: MIT + file LICENSE
URL: https://github.com/jpferreira33/weightflow, https://jpferreira33.github.io/weightflow/
NeedsCompilation: no
Language: en-US
Citation: weightflow citation info
Materials: README, NEWS
In views: OfficialStatistics
CRAN checks: weightflow results

Documentation:

Reference manual: weightflow.html , weightflow.pdf
Vignettes: Machine learning, cross-fitting and robust calibration (source, R code)
Ways to specify calibration totals (source, R code)
Calibration: raking, post-stratification and GREG (source, R code)
Composite estimation: borrowing strength from the previous wave (source, R code)
Coordinated replication: what travels between waves (source, R code)
Inspecting and auditing the cascade (source, R code)
Model calibration (model-assisted weighting) (source, R code)
Non-probability samples (source, R code)
Nonresponse: weighting classes, propensities and calibration (source, R code)
Pure panels: the longitudinal weight and gross flows (source, R code)
Preparing the sample: eligibility and response before weighting (source, R code)
Documenting and auditing the weights: the quality report (source, R code)
From raw sample to final weights (source, R code)
Calibrating to a reference survey (source, R code)
Rotating panels: net change, chaining and gross flows (source, R code)
Trimming survey weights (source, R code)
Two-phase (double) sampling (source, R code)
Validation against survey and ReGenesees (source, R code)
Variance estimation (source, R code)
weightflow in production (GSBPM 5.6) (source, R code)
Staged survey weighting: the adjustment logic (source, R code)

Downloads:

Package source: weightflow_1.3.1.tar.gz
Windows binaries: r-devel: weightflow_1.3.1.zip, r-release: weightflow_1.3.1.zip, r-oldrel: weightflow_1.3.1.zip
macOS binaries: r-release (arm64): weightflow_1.3.1.tgz, r-oldrel (arm64): weightflow_1.3.1.tgz, r-release (x86_64): weightflow_1.3.1.tgz, r-oldrel (x86_64): weightflow_1.3.1.tgz
Old sources: weightflow archive

Linking:

Please use the canonical form https://CRAN.R-project.org/package=weightflow to link to this page.

These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.