A survey design object for equal-probability simple random samples — surveys
where every unit had an equal chance of selection and there is no clustering
or stratification. Create via as_survey() with no ids, strata, or
fpc arguments.
Usage
survey_srs(
data = data.frame(),
metadata = survey_metadata(),
variables = list(),
groups = character(0),
call = NULL
)Arguments
- data
A
data.framecontaining the survey data. Preferas_survey()over calling this constructor directly.- metadata
A survey_metadata object. Created automatically by
as_survey().- variables
A named list of design specification. Set automatically by
as_survey().- groups
Set by surveytidy's
group_by(). Alwayscharacter(0)in standalone surveycore use.- call
Language object capturing the construction call.
When to use this class
Use survey_srs (via as_survey(df) or as_survey(df, weights = w) with
no design structure) when:
The sample was drawn by simple random sampling (every unit equally likely to be selected)
There are no clusters or strata to specify
You want the standard SRS variance formula:
s²/n × (1 - f)wheref = n/Nis the sampling fraction (0 when population size is unknown)
For non-probability samples or post-hoc calibrated weights (raking,
post-stratification, propensity matching), use as_survey_calibrated()
instead.
For complex probability samples with known design structure (PSUs, strata),
use as_survey() with ids, strata, and/or fpc — which creates a
survey_taylor object.
Design variables (@variables)
weightsCharacter string naming the weight column, or
NULLfor uniform weights (all equal; auto-generated as"..surveycore_wt..").probs_providedLogical.
TRUEif the user supplied sampling probabilities rather than weights.fpcCharacter string naming a finite population correction column, or
NULL. WhenNULL, assumes infinite population (f = 0).fpc_typeCharacter string:
"population"when the FPC column contains population sizes (values > 1),"fraction"when it contains sampling fractions (values in (0, 1]), orNULLwhen no FPC is specified.idsAlways
NULL. SRS has no cluster structure.strataAlways
NULL. SRS has no stratification.nestAlways
FALSE.
See also
as_survey_srs() to create a survey_srs object directly;
as_survey() for Taylor series designs.
Other constructors:
as_survey(),
as_survey_calibrated(),
as_survey_rep(),
as_survey_srs(),
as_survey_twophase(),
survey_calibrated(),
survey_data(),
survey_replicate(),
survey_taylor(),
survey_twophase()