Skip to contents

A survey design object for non-probability samples and post-hoc calibrated designs (e.g., raked online panels, post-stratified samples). Create with as_survey_calibrated().

Usage

survey_calibrated(
  data = data.frame(),
  metadata = survey_metadata(),
  variables = list(),
  groups = character(0),
  call = NULL,
  calibration = NULL
)

Arguments

data

A data.frame containing the survey data. Prefer as_survey_calibrated() over calling this constructor directly.

metadata

A survey_metadata object. Created automatically by as_survey_calibrated().

variables

A named list of design specification (weights, probs_provided). Set automatically by as_survey_calibrated().

groups

Set by surveytidy's group_by(). Always character(0) in standalone surveycore use.

call

Language object capturing the construction call.

calibration

The calibration provenance object returned by a surveyweights calibration function (e.g., surveyweights::rake()), or NULL if calibration was performed externally. Stores the calibration targets, variables, and trimming parameters for reproducibility and future bootstrap re-calibration. Default NULL.

Value

A survey_calibrated object.

Phase 2.5 skeleton

This class is a skeleton added in Phase 0 to reserve its place in the class hierarchy. The constructor as_survey_calibrated() accepts pre-computed calibration weights and stores calibration provenance from surveyweights output.

Full functionality — including bootstrap variance with re-calibration on each replicate — will be implemented in Phase 2.5 alongside the surveyweights package. Until then, estimation uses SRS-based variance (same assumption as as_survey() with weights only).

Non-probability samples

Unlike as_survey(), as_survey_rep(), and as_survey_twophase(), this class does not assume a probability sampling design. Standard errors produced from a survey_calibrated object rest on a model-assisted SRS assumption, which is consistent with common practice for calibrated non-probability samples (e.g., raked online panels). See vignette("creating-survey-objects") for guidance on when this is appropriate and what the limitations are.

Design variables (@variables)

weights

Character string naming the (calibrated) weight column.

probs_provided

Always FALSE for calibrated designs.

Calibration provenance (@calibration)

When calibration is performed via surveyweights, 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).