Learn R Programming

nonprobsampling

Inference for Nonprobability Samples Using Multiple Reference Surveys

nonprobsampling implements pseudo-weighting methods for finite population inference from nonprobability samples, such as convenience samples, volunteer cohorts, and opt-in panels. Because the participation mechanism in a nonprobability sample is unknown, unadjusted estimates of population means and prevalences may be biased. The package addresses this issue by leveraging auxiliary information from one or multiple probability reference surveys to estimate participation probabilities and using their inverses as pseudo-weights to obtain bias-corrected estimates of finite population means and prevalences.

The implemented methods are based on the generalized estimating equations framework of Landsman et al. (2026). This includes a multi-reference extension that enables the integration of auxiliary information across multiple reference surveys.

Installation

Install the released version from CRAN (once available):

install.packages("nonprobsampling")

Install the development version from GitHub:

# install.packages("remotes")
remotes::install_github("Jiakun0611/nonprobsampling")

Methods

With one reference survey:

  • Calibration — raking ratio calibration (Landsman et al., 2026)
  • ALP — adjusted logistic propensity weighting (Wang, Valliant, and Li, 2021)
  • CLW — Chen, Li, and Wu (2020)

With multiple reference surveys:

  • Multi-reference calibration — enables the integration of auxiliary information across multiple surveys when no single reference survey contains all variables relevant to participation (Landsman et al., 2026), with an optional cumulative precalibration step to preserve information on the relationships between overlapping and unique auxiliary variables across reference surveys.

Variance estimation is based on Taylor linearization, with complex sampling designs in the reference surveys handled through integration with the survey package; when bootstrap replicate weights are provided, bootstrap-based variance estimation is also supported.

Usage

Estimation proceeds in two steps: est_pw() estimates pseudo-weights, then pwmean() estimates a pseudo-weighted mean or prevalence for an outcome.

library(nonprobsampling)

data(sc)    # nonprobability sample (outcome: psa_level)
data(sp1)   # probability reference survey

# Reference survey design
ref1_design <- survey::svydesign(
  ids     = ~psu_sp1,
  strata  = ~strata_sp1,
  weights = ~wts_sp1,
  data    = sp1,
  nest    = TRUE
)

# Step 1: estimate pseudo-weights (one-reference calibration)
fit <- est_pw(
  data      = list(sc, ref1_design),
  p_formula = ~ agecat + race + education + comorbidity + BMI + diabetes,
  method    = "calibration",
  control   = pw_solver_control(ftol = 1e-6)
)
print(fit)
summary(fit)

# Step 2: pseudo-weighted mean of the outcome, by BMI categories
out <- pwmean(fit, y = "psa_level", zcol = "BMI")
print(out)
summary(out)

With multiple reference surveys, users provide one survey design object for each reference survey and a corresponding list of participation model formulas, with one formula specified for each survey.

data(sp2)   # second probability reference survey

ref2_design <- survey::svydesign(
  ids     = ~psu_sp2,
  strata  = ~strata_sp2,
  weights = ~wts_sp2,
  data    = sp2,
  nest    = TRUE
)

fit2 <- est_pw(
  data = list(sc, ref1_design, ref2_design),
  p_formula = list(
    ~ agecat + race + education + psa_level + pros_enlarged + comorbidity,
    ~ agecat + race + BMI + diabetes + comorbidity
  ),
  sp_order = "size",
  precali = TRUE,
  control = pw_solver_control(ftol = 1e-6)
)
print(fit2)
summary(fit2)

See vignette("nonprobsampling") for more details.

Datasets

The package includes example datasets used throughout the documentation:

DatasetDescription
scNonprobability sample (synthetic, NHANES-based)
sp1First probability reference survey (NHANES 1999–2010)
sp2Second probability reference survey (NHIS 1997–2008)
sp1_bootstrapsp1 with bootstrap replicate weights

Getting help

Run any of the following commands in R to open the corresponding help page (clickable links are available on the package website):

Citation

To cite the package in publications, run:

citation("nonprobsampling")

References

  • Chen, Y., Li, P., and Wu, C. (2020). Doubly robust inference with nonprobability survey samples. Journal of the American Statistical Association, 115(532), 2011–2021. doi:10.1080/01621459.2019.1677241
  • Landsman, V., Wang, L., Carrillo-Garcia, I., Mitani, A. A., Smith, P. M., Graubard, B. I., Bui, T., and Carnide, N. (2026). Correction for participation bias in nonprobability samples using multiple reference surveys. Statistics in Medicine, 45(3–5). doi:10.1002/sim.70403
  • Wang, L., Valliant, R., and Li, Y. (2021). Adjusted logistic propensity weighting methods for population inference using nonprobability volunteer-based epidemiologic cohorts. Statistics in Medicine, 40(24), 5237–5250. doi:10.1002/sim.9122

License

GPL-3 © Jiakun Lin, Victoria Landsman, Aya A. Mitani

Copy Link

Version

Install

install.packages('nonprobsampling')

Version

0.1.0

License

GPL-3

Issues

Pull Requests

Stars

Forks

Maintainer

Jiakun Lin

Last Published

July 7th, 2026

Functions in nonprobsampling (0.1.0)

precal_cumulative_order

Cumulative precalibration across multiple probability samples
prepare_nleqslv_args

Assemble arguments for nleqslv
p_formula_construction

Auto-build a default participation model formula
prepare_sc_data

Extract and align sc data from a build object
print.pw_na_summary

Print method for pw_na_summary
reconstruct_sc_output

Reconstruct the sample data frame with fitted pseudo-weights
solve_participation_model

Solve the participation model estimating equations
summary.pw_fit

Summarize a Pseudo-Weight Fit
summary.pwmean

Summary method for pwmean objects
summary.pwmean_factor

Summary method for pwmean objects with categorical outcomes
process_na_build

Handle missing values at the build stage (first layer)
raking_estimate

Estimate step for raking-ratio calibration
process_na_yz

Handle missing values in the outcome and domain variables
raking_build

Build pseudo-weights using the calibration (raking) method
sort_by_sp_size

Sort reference samples by size
pwmean

Estimate Pseudo-Weighted Means, Prevalences, and Standard Errors
pw_solver_control

Control Solver Settings for Pseudo-Weight Estimation
standardize_zcol

Standardize a domain variable into a common internal format
sc

Nonprobability Sample (sc)
sp2

Probability Reference Sample 2 (sp2)
sp1

Probability Reference Sample 1 (sp1)
sp1_bootstrap

Probability Reference Sample 1 with Bootstrap Replicate Weights (sp1_bootstrap)
alp_build

Build pseudo-weights using the ALP method
check_nleqslv_result

Check the result returned by nleqslv
assemble_output

Assemble the final output object
clw_build

Build pseudo-weights using the CLW method
dispatch_estimator_one_domain

Run the estimator for a single domain
dispatch_estimator

Dispatch the estimator across domains
compute_D_raking

Compute design-based covariance matrix D for calibration
compute_D_ALP

Compute design-based covariance matrix D for ALP
compute_D_CLW

Compute design-based covariance matrix D for CLW
est_pw

Estimate Pseudo-Weights for Nonprobability Samples
na.action.pw_fit

Extract NA action from a pw_fit object
na.action.pwmean

Extract NA action from a pwmean object
naive_mean_one_domain

Compute the naive mean for one domain
multi_estimate

Estimate step for multi-reference raking
check_input_multi

Validate inputs and build variable sets for multi-reference calibration
check_ipwm_inputs_estimate

Validate inputs at the estimation stage
make_block_D_multi

Construct block-diagonal D matrix for multi-reference raking
ipwm_multi_build

Build pseudo-weights for the multi-reference calibration method
clw_estimate

Estimate step for the CLW estimator
alp_estimate

Estimate step for the ALP estimator
build_domains_df

Build the estimates summary data frame
ipwm_one_build

Dispatch one-reference pseudo-weight estimation
print.pw_fit

Print method for pw_fit objects
naive_mean

Compute naive (unweighted) means from the convenience sample
multi_matrix_construction

Construct block design matrices for multi-reference calibration
check_estimating_system

Validate the Jacobian and estimating equation vector
multi_raking_block_cols

Map each reference-sample block to its column indices in Xc
multi_raking_fp

Compute reference weighted totals for multi-reference calibration
multi_raking_start

Compute starting values for multi-reference calibration
parse_ipwm_data

Parse the data list passed to est_pw
print.pwmean

Print method for pwmean objects
extract_analysis_data

Extract analysis data from a survey design object
nonprobsampling-package

nonprobsampling: Inference for Nonprobability Samples Using Multiple Reference Surveys
print.pwmean_factor

Print method for pwmean objects with categorical outcomes
finalize_pw_fit

Finalize and assemble the `pw_fit` return object