What you actually got, against what the design asked for. Worth a look before analysing: it surfaces strata that came up short, weights that vary more than you expected, and rows the design could never have reached.
Arguments
- sample
A data frame returned by
draw()withweights = TRUE.
Value
A list with a print() method, holding:
designThe design's type, as a string.
n,NRows drawn, and rows in the frame.
weight_rangeThe smallest and largest design weight.
weight_cvTheir coefficient of variation. Large values mean a few rows carry most of the estimate.
unreachableFrame rows with inclusion probability 0 — the design could never have selected them.
NAif the design has no closed-form inclusion probability.by_groupA data frame of
group,drawn,in_frameandrateper stratum or cluster, orNULLfor a design with no grouping.group_colThe column(s)
by_groupis keyed on.
Examples
set.seed(1)
pop <- data.frame(
id = 1:400,
site = rep(c("a", "b", "c", "d"), times = c(200, 100, 60, 40))
)
s <- draw(pop, design_stratified("site", n = 40), seed = 1, weights = TRUE)
sample_summary(s)
#> Sample of 40 from 400 (stratified design)
#> sampling fraction 0.1
#> design weights 10 to 10 (cv 0)
#>
#> by site:
#> group drawn in frame rate
#> a 20 200 0.100
#> b 10 100 0.100
#> c 6 60 0.100
#> d 4 40 0.100