A survey design object for non-probability samples (e.g., online panels,
quota samples, volunteer panels) with calibration weights (including raking
and post-stratification) or inverse probability weighting (IPW)
pseudo-weights. Create with
as_survey_nonprob().
Usage
survey_nonprob(
data = data.frame(),
metadata = survey_metadata(),
variables = list(),
groups = character(0),
call = NULL,
calibration = NULL,
reference_sample = NULL
)Arguments
- data
A
data.framecontaining the survey data. Preferas_survey_nonprob()over calling this constructor directly.- metadata
A survey_metadata object. Created automatically by
as_survey_nonprob().- variables
A named list of design specification (
weights,probs_provided). Set automatically byas_survey_nonprob().- groups
Set by surveytidy's
group_by(). Alwayscharacter(0)in standalone surveycore use.- call
Language object capturing the construction call.
- calibration
The calibration provenance object returned by a surveywts calibration function (e.g.,
surveywts::rake()), orNULLif calibration was performed externally. Stores the calibration targets, variables, and trimming parameters for reproducibility and future bootstrap re-calibration. DefaultNULL.- reference_sample
Optional survey_taylor object representing the probability-based reference sample used to estimate propensity scores or calibration targets. Stored for reproducibility. Default
NULL.
Variance estimation
Two modes are available, selected by whether @variables$repweights is
NULL:
- SRS approximation (no replicate weights)
Standard errors treat the calibrated weights as fixed and assume simple random sampling. This understates calibration uncertainty and should only be used when replicate weights are unavailable.
- Replicate variance (repweights supplied)
Bootstrap or jackknife replicate weights propagate calibration uncertainty into the variance estimate. Each replicate column must contain calibrated weights re-estimated on one replicate draw. This is the recommended approach.
See as_survey_nonprob() for the full parameter interface, including
type, scale, rscales, and mse.
Non-probability samples
Unlike as_survey(), as_survey_replicate(), and as_survey_twophase(),
this class does not assume a probability sampling design. When no
replicate weights are supplied, standard errors rest on a model-assisted SRS
assumption, which is consistent with common practice for calibrated
non-probability samples (e.g., raked online panels). When replicate weights
are supplied, bootstrap or jackknife variance is used instead. See
vignette("creating-survey-objects") for guidance on choosing between these
modes and the limitations of each.
Design variables (@variables)
weightsCharacter string naming the (calibrated) weight column.
repweightsCharacter vector of bootstrap replicate weight column names, or
NULLwhen no replicate weights are present.typeReplicate type. Only
"bootstrap"is supported for non-probability samples ("JK1","JK2", and"JKn"are not accepted); orNULLwhen no replicate weights are present.scaleNumeric scale factor for the variance formula, or
NULL.rscalesPer-replicate scale factors, or
NULL.mseLogical.
TRUEfor MSE form of variance, orNULL.probs_providedAlways
FALSEfor calibrated designs.
Calibration provenance (@calibration)
When calibration is performed via surveywts, the returned calibration
object is stored here. It contains the calibration targets, variables used,
trimming cap, effective sample size before and after, and design effect.
NULL when calibration was performed externally (e.g., via anesrake).
See also
as_survey_nonprob() to create a survey_nonprob object.
Other constructors:
as_caldata(),
as_survey(),
as_survey_nonprob(),
as_survey_replicate(),
as_survey_twophase(),
survey_glm(),
survey_glm_fit(),
survey_replicate(),
survey_taylor(),
survey_twophase()
