| Title: | Inference for Nonprobability Samples Using Multiple Reference Surveys |
|---|---|
| Description: | Provides pseudo-weighted estimates of means and prevalences for finite population inference from nonprobability samples using auxiliary information from one or multiple probability reference surveys. The package supports estimation with multiple reference surveys, allowing auxiliary information to be combined when no single survey contains all variables relevant to participation. Optional cumulative precalibration can be applied to align weighted totals of shared variables across surveys. Methods are based on the generalized estimating equations framework of Landsman et al. (2026) <doi:10.1002/sim.70403> for correcting participation bias. For a single reference survey, the package implements the raking ratio calibration method and includes the adjusted logistic propensity (ALP) method of Wang, Valliant, and Li (2021) <doi:10.1002/sim.9122>, as well as the Chen-Li-Wu (CLW) method of Chen, Li, and Wu (2020) <doi:10.1080/01621459.2019.1677241>. Analytic variance estimation uses Taylor linearization and accounts for complex sampling designs in the reference surveys via integration with the 'survey' package. |
| Authors: | Jiakun Lin [aut, cre], Victoria Landsman [aut], Aya A. Mitani [aut] |
| Maintainer: | Jiakun Lin <[email protected]> |
| License: | GPL-3 |
| Version: | 0.1.0 |
| Built: | 2026-07-07 17:20:02 UTC |
| Source: | https://github.com/cran/nonprobsampling |
est_pw() estimates pseudo-weights for a nonprobability sample using
one reference survey or multiple reference surveys. The function specifies the
participation model, handles missing values in the participation model
variables, solves the estimating equations, and stores the quantities needed
for downstream point and variance estimation.
Users should harmonize variable names and coding before calling
est_pw(). Variables used in the participation model must have
consistent names and compatible definitions across the nonprobability sample
and the reference survey data used for estimation.
With one reference survey, the available methods include the raking ratio calibration method described in Landsman et al. (2026), the adjusted logistic propensity weighting (ALP) method proposed by Wang, Valliant, and Li (2021), and the CLW method proposed by Chen, Li, and Wu (2020). With multiple reference surveys, pseudo-weights are estimated using the multi-reference calibration method proposed by Landsman et al. (2026).
The returned object is designed to be passed to pwmean.
est_pw( data, sp_order = c("size", "given"), precali = TRUE, p_formula = NULL, method = NULL, na.action = stats::na.omit, sc_wname = "pseudo_wts", control = pw_solver_control(), verbose = FALSE )est_pw( data, sp_order = c("size", "given"), precali = TRUE, p_formula = NULL, method = NULL, na.action = stats::na.omit, sc_wname = "pseudo_wts", control = pw_solver_control(), verbose = FALSE )
data |
A list of input data objects of the form
|
sp_order |
Character string controlling the order of reference surveys
when multiple reference surveys are used. Supported values are
|
precali |
Logical. Used only with multiple reference surveys. If
|
p_formula |
Optional participation model formula. Must always be
one-sided (no response variable on the left-hand side). A two-sided formula
such as With one reference survey, supply a single one-sided formula, for example
|
method |
Character string specifying the pseudo-weighting method, or
To override the default, supply one of the following values. For a
one-reference method: The argument is case-insensitive, so inputs such as
|
na.action |
Function specifying how missing values should be handled for
variables used in the participation model. Common choices include
|
sc_wname |
Character string giving the name of the pseudo-weight column
added to the returned nonprobability sample. Default is
|
control |
A solver control object created by
|
verbose |
Logical. If |
est_pw() performs pseudo-weight estimation for the nonprobability
sample and stores the method-specific internal objects needed later by
pwmean. It does not require an outcome variable.
The input data must be provided as a list, where the first element is
the nonprobability sample and the remaining elements are reference survey
design objects. Reference survey designs can be created with
svydesign for standard complex survey designs or
svrepdesign for surveys with replicate weights. These
objects preserve the sampling structure needed for design-consistent
variance estimation.
Variable harmonization.
Variables are matched by name, not by meaning. Before applying
est_pw(), shared variables must be harmonized across the
nonprobability sample and reference survey data. For example, if a
categorical variable is named agecat in the nonprobability sample and
age_group in the reference survey, the user should rename one of the
variables before estimation.
Categorical variables should be encoded as factors with compatible category
definitions and identical levels in the same order. Even when categories are
substantively equivalent, mismatched factor levels may cause
est_pw() to return an error. Continuous variables included in the
participation model should also be measured on comparable scales across
datasets.
Internally, est_pw() performs the following steps:
Input validation
Validates the structure and required components of the input data.
Reference survey detection
Determines whether the input contains a single reference survey or
multiple reference surveys.
Method selection
Selects the pseudo-weighting method based on the specified argument(s).
Participation model specification
Constructs a default participation model formula when
p_formula = NULL.
Missing data handling
Applies missing-data handling procedures to variables used in the
participation model.
Model matrix construction
Generates model matrices from the participation model variables.
Pseudo-weight estimation
Estimates pseudo-weights using the selected method.
Output augmentation
Appends the estimated pseudo-weights as a new column to the
nonprobability sample.
Metadata storage
Stores information related to missing-data handling and other internal
objects for later use or diagnostics.
An object of class "pw_fit". This is a list containing user-facing
outputs and internal objects required by pwmean.
Important components include:
sc_updatedA data frame containing the nonprobability sample with an added
pseudo-weight column named by sc_wname.
pseudo_weightsThe estimated pseudo-weight vector. With stats::na.omit, the
vector contains only observations retained for pseudo-weight estimation.
With stats::na.exclude, excluded observations receive NA
and the vector has length nrow(sc).
coefficientsEstimated coefficients for the participation model variables.
solver_diagnosticsA list of solver diagnostics: solver (solver name),
termcd (termination code), message (solver message),
iter (number of iterations), and fmax (maximum absolute
value of the final estimating equations at convergence).
methodThe pseudo-weighting method used by the function.
internalA list of internal objects needed for downstream estimation.
na_summaryAn object of class "pw_na_summary" summarizing the number of rows
excluded from the nonprobability sample and each reference survey due to
missing participation model variables. NULL if no rows were
excluded.
callThe matched function call.
If data contains one reference survey design object, est_pw()
fits a one-reference method. If data contains more
than one reference survey design objects, est_pw() fits the
multi-reference calibration method.
In both settings, the auxiliary variables used for pseudo-weight estimation
should be harmonized across all data sources before calling
est_pw().
When precali = TRUE, cumulative precalibration is performed before the
main multi-reference calibration step. For overlapping
auxiliary variables, this procedure calibrates the survey weights of a
reference survey so that its weighted totals of the overlapping variables
and its sum of weights match the corresponding totals from the preceding
reference survey in the cumulative order. If there are no overlapping
auxiliary variables, cumulative precalibration is applied only to the sum of
weights.
The order of the reference surveys is controlled by sp_order. If
sp_order = "size", reference surveys are ordered by sample size, from
largest to smallest. If sp_order = "given", the user-specified order
of the reference surveys is used.
Cumulative precalibration is based only on overlapping variables that are
specified in p_formula, rather than on all overlapping variables in
the reference surveys. This choice avoids excluding observations because
of missing values in variables that are not used for pseudo-weight
estimation.
Missing values are handled only for variables used in the participation
model. The selected na.action is recorded in the returned object,
together with the row indices of the nonprobability sample observations
retained for pseudo-weight estimation.
With stats::na.omit, rows with missing participation model variables
are removed from sc_updated. With stats::na.exclude, the
original rows are retained in sc_updated, but excluded rows receive
NA in the pseudo-weight column. This can be useful when users want to
preserve row alignment with the original nonprobability sample for later imputation or merging.
Numerical settings are supplied through the control argument, which
should be created by pw_solver_control. This object controls
solver choice, convergence tolerance, maximum iterations, tracing, and
optional solver-specific arguments.
The top-level ftol, xtol, and maxit values in
pw_solver_control are the package-level convergence controls
used by pseudo-weight estimation stages. When the selected solver is
"nleqslv", additional arguments can be passed through
nleqslv_control. These are forwarded to nleqslv::nleqslv().
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
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
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
data(sc) data(sp1) data(sp2) ## One-reference example ref1_design <- survey::svydesign( ids = ~psu_sp1, strata = ~strata_sp1, weights = ~wts_sp1, data = sp1, nest = TRUE ) fit1 <- 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(fit1) summary(fit1) ## Multi-reference example 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)data(sc) data(sp1) data(sp2) ## One-reference example ref1_design <- survey::svydesign( ids = ~psu_sp1, strata = ~strata_sp1, weights = ~wts_sp1, data = sp1, nest = TRUE ) fit1 <- 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(fit1) summary(fit1) ## Multi-reference example 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)
Returns the na.action component recorded during the build step.
## S3 method for class 'pw_fit' na.action(object, ...)## S3 method for class 'pw_fit' na.action(object, ...)
object |
An object of class |
... |
Additional arguments (not used). |
The na.action object recorded by est_pw during
the build step: an integer vector of the nonprobability-sample rows omitted
because of missing participation model variables (of class "omit" or
"exclude"), or NULL if no rows were omitted.
Returns the na.action component recorded during estimation,
mimicking na.action behavior for fitted model objects.
## S3 method for class 'pwmean' na.action(object, ...)## S3 method for class 'pwmean' na.action(object, ...)
object |
An object of class |
... |
Additional arguments (not used). |
The na.action object recorded by pwmean: an
integer vector of rows omitted because of missing outcome or domain values
(of class "omit" or "exclude"), or NULL if no rows were
omitted.
Compact one-screen overview of a fitted pseudo-weight object: the call, the
pseudo-weighting method, the participation model size, solver convergence,
and a summary of the estimated pseudo-weights. For the full coefficient
table and detailed solver diagnostics, use summary.pw_fit.
## S3 method for class 'pw_fit' print(x, ...)## S3 method for class 'pw_fit' print(x, ...)
x |
An object of class |
... |
Additional arguments, currently unused. |
Invisibly returns x.
Prints a formatted table showing the original row count, rows used, and rows excluded due to missing participation model variables, for each dataset ('sc' and each reference survey).
## S3 method for class 'pw_na_summary' print(x, ...)## S3 method for class 'pw_na_summary' print(x, ...)
x |
A 'pw_na_summary' object returned by '.report_na_exclusions()'. |
... |
Further arguments passed to or from other methods (unused). |
Invisibly returns 'x'.
Displays the pseudo-weighted mean estimate and its uncertainty. For factor-like domain variables, prints one row per domain level.
## S3 method for class 'pwmean' print(x, ...)## S3 method for class 'pwmean' print(x, ...)
x |
An object of class |
... |
Additional arguments, currently unused. |
Invisibly returns x.
Displays pseudo-weighted prevalence estimates and their uncertainty.
## S3 method for class 'pwmean_factor' print(x, ...)## S3 method for class 'pwmean_factor' print(x, ...)
x |
An object of class |
... |
Additional arguments, currently unused. |
Invisibly returns x.
pw_solver_control() creates a solver control object used by
est_pw to manage numerical settings for pseudo-weight
estimation.
pw_solver_control( solver = "nleqslv", maxit = NULL, trace = FALSE, method = c("Newton", "Broyden"), global = c("dbldog", "cline", "pwldog", "qline", "gline", "hook", "none"), xscalm = c("fixed", "auto"), ftol = 1e-08, xtol = 1e-08, nleqslv_control = list() )pw_solver_control( solver = "nleqslv", maxit = NULL, trace = FALSE, method = c("Newton", "Broyden"), global = c("dbldog", "cline", "pwldog", "qline", "gline", "hook", "none"), xscalm = c("fixed", "auto"), ftol = 1e-08, xtol = 1e-08, nleqslv_control = list() )
solver |
Character string specifying the numerical solver used for
solving the estimating equations. Currently, only |
maxit |
Positive finite numeric value passed to
|
trace |
Logical. If |
method |
Character string specifying the numerical method passed to
|
global |
Character string specifying the global strategy passed to
|
xscalm |
Character string specifying the scaling method passed to
|
ftol |
Positive finite numeric value passed to
|
xtol |
Positive finite numeric value passed to
|
nleqslv_control |
A list of additional control options
passed to |
The control object stores solver settings used by pseudo-weight estimation
step. It is passed to est_pw through the control
argument.
Currently, only solver = "nleqslv" is supported. The arguments
method, global, xscalm, ftol, xtol, and
maxit correspond to options used by nleqslv::nleqslv().
They are collected internally and passed to nleqslv::nleqslv() at the
pseudo-weight estimation step.
The argument ftol is the function-value convergence tolerance. It
controls convergence based on the size of the estimating function. The
argument xtol is the parameter-step convergence tolerance. It controls
convergence based on changes in the parameter vector. The argument
maxit controls the maximum number of solver iterations.
Additional, less commonly used nleqslv control options can be supplied
through nleqslv_control. To avoid ambiguity, do not supply
ftol, xtol, maxit, or trace inside
nleqslv_control; use the main arguments instead.
A flat list containing all solver control settings for pseudo-weight estimation:
solverThe selected numerical solver.
methodThe nleqslv numerical method.
globalThe nleqslv global strategy.
xscalmThe nleqslv scaling method.
ftolThe function-value convergence tolerance.
xtolThe parameter-step convergence tolerance.
maxitThe maximum number of solver iterations, stored as an integer.
150 if a global strategy is used; 20 if global = "none".
Since the default global strategy is "dbldog", the effective default
is 150 unless global = "none" is explicitly specified.
traceLogical value indicating whether tracing information is requested.
nleqslv_controlA list of additional options passed to
nleqslv::nleqslv().
## Default solver control settings ctrl <- pw_solver_control() ## Custom nleqslv solver settings ctrl <- pw_solver_control( maxit = 20, trace = FALSE, method = "Newton", global = "cline", xscalm = "auto", ftol = 1e-8, xtol = 1e-10 ) ## Additional nleqslv control options ctrl <- pw_solver_control( method = "Newton", global = "dbldog", nleqslv_control = list( btol = 1e-3 ) )## Default solver control settings ctrl <- pw_solver_control() ## Custom nleqslv solver settings ctrl <- pw_solver_control( maxit = 20, trace = FALSE, method = "Newton", global = "cline", xscalm = "auto", ftol = 1e-8, xtol = 1e-10 ) ## Additional nleqslv control options ctrl <- pw_solver_control( method = "Newton", global = "dbldog", nleqslv_control = list( btol = 1e-3 ) )
Computes pseudo-weighted means and standard errors using a fitted
pseudo-weight object of class "pw_fit" returned by
est_pw. The function applies second-layer missing-data
handling for the outcome and optional domain variable, and then estimates
overall or domain-specific means or prevalences using the pseudo-weighting
method stored in object.
pwmean(object, y, zcol = NULL, na.action = stats::na.omit)pwmean(object, y, zcol = NULL, na.action = stats::na.omit)
object |
An object of class |
y |
A character string specifying the name of the outcome variable in the
nonprobability sample stored in |
zcol |
Optional character string giving the name of a categorical domain
variable in the nonprobability sample stored in the |
na.action |
Function specifying how missing values in |
Missing data handling (layer 2).
After pseudo-weights are constructed by est_pw(), estimation of the
mean requires complete cases for the outcome y and, if supplied, the
domain variable zcol. The argument na.action controls how
these missing values are handled at the outcome-estimation step.
Input object.
The object argument should be an object of class "pw_fit"
returned by est_pw. It stores the estimated pseudo-weights,
participation model information, and design-based quantities required for point
and variance estimation.
Categorical outcomes.
When y is a categorical variable (defined as a factor in R),
pwmean() estimates the prevalence (proportion) of each category.
To do so, each category is internally converted into a 0/1 indicator
variable, and the pseudo-weighted mean estimator is then computed for each
indicator.
An object of class "pwmean" containing unweighted and pseudo-weighted
estimates, standard errors, and confidence intervals. For categorical outcomes,
the estimate columns contain category prevalences.
methodCharacter. The pseudo-weighting method used.
estimatesA data frame containing the unweighted and pseudo-weighted estimates.
For numeric outcomes, the first column is domain. If
zcol = NULL, domain is "Overall". If zcol
is a logical variable or a numeric/integer
variable containing only 0 and 1, there is one row with
domain labeled "<zcol> = 1". If zcol is a
factor or character variable, there is one row per
zcol level, with domain labeled
"<zcol> = <level>".
For categorical outcomes, the first two columns are
category and domain. category identifies the
outcome level as "<y> = <level>". If zcol = NULL,
domain is "Overall" for each outcome level. If
zcol is supplied, the rows are formed by each outcome category
within each domain, and domain follows the same labels described
above for zcol.
The columns are:
categoryCategory label for categorical outcomes only.
domainDomain label.
unweighted_mean, unweighted_se
Unweighted
mean of y and its standard error.
unweighted_lower, unweighted_upper
Bounds of the 95% confidence interval for the unweighted mean, based on the normal approximation.
adjusted_mean, adjusted_se
Pseudo-weighted mean
of y and its standard error.
adjusted_lower, adjusted_upper
Bounds of the 95% confidence interval for the pseudo-weighted mean, based on the normal approximation.
na.actionInteger vector of row indices omitted at the outcome-estimation step,
with class "omit" or "exclude" matching the
na.action argument, or NULL if no observations were
omitted. The indices refer to the nonprobability sample available to
pwmean() after missing-data handling in
est_pw().
callThe matched function call.
est_pw,
summary.pwmean,
print.pwmean
data(sc) data(sp1) ref1_design <- survey::svydesign( ids = ~psu_sp1, strata = ~strata_sp1, weights = ~wts_sp1, data = sp1, nest = TRUE ) 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) ) out <- pwmean(fit, y = "psa_level", zcol = "BMI") print(out) summary(out)data(sc) data(sp1) ref1_design <- survey::svydesign( ids = ~psu_sp1, strata = ~strata_sp1, weights = ~wts_sp1, data = sp1, nest = TRUE ) 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) ) out <- pwmean(fit, y = "psa_level", zcol = "BMI") print(out) summary(out)
This dataset represents a synthetic nonprobability sample generated via
Poisson sampling from a finite population constructed from the National
Health and Nutrition Examination Survey (NHANES) cycles 1999–2010. It is
intended to illustrate the pseudo-weighting methods implemented in the
nonprobsampling package.
data(sc)data(sc)
A data frame with 2404 observations and 8 variables:
Outcome variable: serum prostate-specific antigen level (numeric)
Body mass index category (factor with 4 levels: "Normal", "Overweight", "Obese", "Morbidly Obese")
Race category (factor with 4 levels: 1 = White, 2 = Black, 3 = Hispanic, 4 = Other)
Age category (factor with 4 levels: 1 = 55–59, 2 = 60–64, 3 = 65–69, 4 = 70+)
Education level (factor with 5 levels: 1 = Less Than 8 Years, 2 = 8–11 Years, 3 = 12 Years Or Completed High School, 4 = College Graduate, 5 = Postgraduate)
Prostate enlargement indicator (factor with 2 levels: 0 = No, 1 = Yes)
General comorbidity indicator (factor with 2 levels: 0 = No, 1 = Yes)
Diabetes diagnosis indicator (factor with 2 levels: 0 = No, 1 = Yes)
The dataset has 2,404 complete-case observations, with
psa_level serving as the outcome variable. Auxiliary variables
shared with the probability reference surveys sp1 and sp2
are used to construct pseudo-weights aimed at correcting for participation
bias.
Synthetic data generated by the package authors. The underlying finite population was constructed from the National Health and Nutrition Examination Survey (NHANES), 1999–2010 cycles, conducted by the U.S. National Center for Health Statistics (NCHS).
data(sc) str(sc) summary(sc)data(sc) str(sc) summary(sc)
This dataset represents a probability sample derived from the
1999–2010 cycles of the National Health and Nutrition
Examination Survey (NHANES). It is used as a probability
reference survey to support the pseudo-weighting methods
implemented in the nonprobsampling package.
data(sp1)data(sp1)
A data frame with 3494 observations and 14 variables:
Age category (factor with 4 levels: 1 = 55–59, 2 = 60–64, 3 = 65–69, 4 = 70+)
Marital status (factor with 4 levels: 1 = Married Or Living As Married, 2 = Widowed, 3 = Divorced or Separated, 4 = Never Married)
Race category (factor with 4 levels: 1 = White, 2 = Black, 3 = Hispanic, 4 = Other)
Education level (factor with 5 levels: 1 = Less Than 8 Years, 2 = 8–11 Years, 3 = 12 Years Or Completed High School, 4 = College Graduate, 5 = Postgraduate)
Employment status (factor with 2 levels: 0 = Not Working, 1 = Working)
Smoking status (factor with 3 levels: 1 = Never Smoker, 2 = Former Smoker, 3 = Current Smoker)
General comorbidity indicator (factor with 2 levels: 0 = No, 1 = Yes)
Serum prostate-specific antigen level (numeric)
Body mass index category (factor with 4 levels: "Normal", "Overweight", "Obese", "Morbidly Obese")
Diabetes diagnosis indicator (factor with 2 levels: 0 = No, 1 = Yes)
Prostate enlargement indicator (factor with 2 levels: 0 = No, 1 = Yes)
Stratum identifier for complex survey design (numeric)
Primary sampling unit identifier for complex survey design (numeric)
10-year interview sampling weights (numeric)
The dataset includes auxiliary variables shared with the nonprobability
sample sc, enabling the construction of pseudo-weights to adjust
for participation bias. Survey design variables and sampling weights are
provided to support design-consistent estimation.
The sp1 dataset
contains the outcome variable psa_level, which is also observed in
sc, allowing for the evaluation of pseudo-weighted estimators against
estimates based on true sampling weights. It may also be incorporated into
the participation model, potentially enhancing bias reduction when
participation depends on the outcome.
Derived from the National Health and Nutrition Examination Survey (NHANES), 1999–2010 cycles, conducted by the U.S. National Center for Health Statistics (NCHS).
data(sp1) str(sp1) summary(sp1)data(sp1) str(sp1) summary(sp1)
A replicate-weight version of sp1, including the main survey weight
and 500 bootstrap replicate weights. It is provided to illustrate
design-based variance estimation with svrepdesign.
The original primary sampling unit and stratum identifiers are not included.
data(sp1_bootstrap)data(sp1_bootstrap)
A data frame with 3494 rows and 512 columns. The first 12 columns
are the substantive survey variables from sp1 (agecat,
marital, race, education, employment,
smoking, comorbidity, psa_level, BMI,
diabetes, pros_enlarged, wts_sp1). The remaining
500 columns are bootstrap replicate weights named bw1 through
bw500 (numeric).
The bootstrap replicate weights were constructed from the original
stratified cluster design of sp1, using the Rao-Wu rescaling
bootstrap method. A total of R = 500 replicates were
produced with seed = 2026.
The variables psu_sp1 and strata_sp1 are not included in this
dataset because they are not needed when using replicate weights for
variance estimation. The main survey weight wts_sp1 and the replicate
weight columns bw1–bw500 are sufficient for constructing a
replicate-weight survey design object via survey::svrepdesign().
Derived from sp1 (National Health and Nutrition Examination Survey,
NHANES, 1999–2010 cycles), with bootstrap replicate weights added by the
package authors using the Rao-Wu rescaling bootstrap.
data(sp1_bootstrap) # Example: create replicate-weight survey design object des_boot <- survey::svrepdesign( data = sp1_bootstrap, weights = ~wts_sp1, repweights = "bw[0-9]+", type = "bootstrap", combined.weights = FALSE ) summary(des_boot)data(sp1_bootstrap) # Example: create replicate-weight survey design object des_boot <- survey::svrepdesign( data = sp1_bootstrap, weights = ~wts_sp1, repweights = "bw[0-9]+", type = "bootstrap", combined.weights = FALSE ) summary(des_boot)
This dataset represents a probability survey derived from the
1997–2008 cycles of the National Health Interview Survey (NHIS).
It is intended for use
alongside sc and sp1 to illustrate the multi-reference
calibration method implemented in the nonprobsampling package.
data(sp2)data(sp2)
A data frame with 35525 observations and 11 variables:
Age category (factor with 4 levels: 1 = 55–59, 2 = 60–64, 3 = 65–69, 4 = 70+)
Marital status (factor with 4 levels: 1 = Married Or Living As Married, 2 = Widowed, 3 = Divorced or Separated, 4 = Never Married)
Race category (factor with 4 levels: 1 = White, 2 = Black, 3 = Hispanic, 4 = Other)
Employment status (factor with 2 levels: 0 = Not Working, 1 = Working)
Diabetes diagnosis indicator (factor with 2 levels: 0 = No, 1 = Yes)
Body mass index category (factor with 4 levels: "Normal", "Overweight", "Obese", "Morbidly Obese")
Smoking status (factor with 3 levels: 1 = Never Smoker, 2 = Former Smoker, 3 = Current Smoker)
General comorbidity indicator (factor with 2 levels: 0 = No, 1 = Yes)
Sampling weights (numeric)
Stratum identifier for complex survey design (numeric)
Primary sampling unit identifier for complex survey design (numeric)
The dataset includes auxiliary variables shared with the nonprobability
sample sc, enabling the construction of pseudo-weights to adjust
for participation bias. Survey design variables and sampling weights are
provided to support design-consistent estimation.
Derived from the National Health Interview Survey (NHIS), 1997–2008 cycles, conducted by the U.S. National Center for Health Statistics (NCHS).
data(sp2) str(sp2) summary(sp2)data(sp2) str(sp2) summary(sp2)
Summarize a Pseudo-Weight Fit
## S3 method for class 'pw_fit' summary(object, ...)## S3 method for class 'pw_fit' summary(object, ...)
object |
An object of class |
... |
Additional arguments, currently unused. |
Invisibly returns object.
Provides console output for objects of class "pwmean", including
unweighted and pseudo-weighted mean estimates, standard errors, confidence
intervals, and optional domain-level summaries.
## S3 method for class 'pwmean' summary(object, ...)## S3 method for class 'pwmean' summary(object, ...)
object |
An object of class |
... |
Additional arguments, currently unused. |
Invisibly returns object.
Provides console output for objects of class "pwmean_factor",
including unweighted and pseudo-weighted prevalence estimates, standard
errors, and confidence intervals.
## S3 method for class 'pwmean_factor' summary(object, ...)## S3 method for class 'pwmean_factor' summary(object, ...)
object |
An object of class |
... |
Additional arguments, currently unused. |
Invisibly returns object.