Creates a survey design object for equal-probability simple random samples
(SRS). Computes variances using the classical SRS formula
var(ȳ) = (1 - f) × s² / n, where s² is the unweighted sample variance,
n is the sample size, and f = n/N is the sampling fraction (0 when
population size is unknown).
Arguments
- data
A
data.framecontaining the survey responses. Must have at least one row and unique column names.- weights
<
tidy-select> Sampling weight column (a single column, values strictly > 0). Supply eitherweightsorprobs, not both. If both areNULL, uniform weights (= 1) are auto-assigned and a warning is issued; population totals will then equal sample totals, not estimated population totals.- probs
<
tidy-select> Sampling probability column (a single column, values in (0, 1]). Converted to weights= 1/probsand stored internally as..surveycore_wt... Supply eitherweightsorprobs, not both.- fpc
<
tidy-select> Finite population correction column (a single column). Accepts either total population size (all values > 1) or sampling fraction (all values in (0, 1]). Cannot mix the two types. Cannot containNAor non-positive values. If any FPC value (of population-size type) is less than the sample size, an error is thrown.
See also
as_survey() for designs with cluster or stratification structure,
as_survey_rep() for replicate-weight designs
Other constructors:
as_survey(),
as_survey_calibrated(),
as_survey_rep(),
as_survey_twophase(),
survey_calibrated(),
survey_data(),
survey_replicate(),
survey_srs(),
survey_taylor(),
survey_twophase()
Examples
# Minimal: no weights, no FPC (uniform weights auto-assigned)
d <- suppressWarnings(as_survey_srs(data.frame(y = 1:5)))