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.
N_reachableRows of the frame the design gives a probability above 0, the population it samples. For weights conditional on the clusters selected, the rows of the clusters not selected count, since another selection could have drawn them. The printed sampling fraction is
n / N_reachable.NAonly when the frame's probabilities cannot be worked out, for an empty sample saved by drawn 0.2.0, which records none, from a design with no closed-form inclusion probability. The fraction is thenn / N.expected_nThe sample size the design expects, the sum of the inclusion probabilities over the frame. It is
nfor a design of fixed size, and printed besidenwhen the two differ, as they can under Poisson sampling, adesign_systematic()intervalthat does not divide the frame, or clusters of unequal size.NAwhereN_reachableis, and for weights conditional on the clusters selected.weight_rangeThe smallest and largest design weight.
weight_cvTheir coefficient of variation. Large values mean a few rows carry most of the estimate.
n_kishKish's effective sample size,
sum(w)^2 / sum(w^2)over the weightsw, which isn / (1 + cv^2)with the coefficient of variation computed with divisorn: the size of a simple random sample that would estimate a mean as precisely if unequal weights were the only cost. Clustering and stratification are not in it;deff()measures those.n_certainSampled rows taken with certainty, at a probability of 1.
certain_byThose rows by why they are certain, a named count:
threshold, above the threshold ofdesign_certainty();size, put at probability 1 by a size measure, indesign_weighted()or indesign_spread()ordesign_multistage()withsize, which includes the rows of a cluster put at 1 by its size and then taken whole; andwhole, in a stratum, interval or cluster taken whole, or a census, with a size measure or without. Under a size measure a group counts as taken whole when the design gives every row of it probability 1, or every cluster of a multistage design a first-stage probability of 1, so a Poisson sample that holds every row of a stratum by chance files its certain rows undersize.conditionalThe number of clusters selected, when the weights are conditional on them, as for
design_cluster()withbalanced = TRUE(see "Design weights" indraw()); otherwiseNA.unreachableFrame rows with inclusion probability 0, which the design could never have selected, such as rows
na_rmdrops.NAwhereN_reachableis.by_groupA data frame of
group,drawn,in_frameandrateper stratum, interval or cluster, orNULLfor a design with no grouping. The strata are those ofdesign_stratified(), and ofdesign_spread()anddesign_weighted()when they havestrata, and every stratum of the frame is listed, one allocated no rows included. A stratum'sin_framecounts the rows the design can draw from it, asNofallocation_table()does, so rowsna_rmdrops are left out, and a stratum it empties is not listed. The intervals ofdesign_temporal()are listed in time order and named by their start, such as"2024-01-03 00:00". Fordesign_cluster()anddesign_multistage(), only the clusters drawn are listed. Fordesign_certainty(), the groups are those of itsrestover the rows below the threshold, after a"(certain)"row for the rows above it.group_colThe column(s)
by_groupis keyed on.drawnHow the sample was drawn, from its
drawn_metaattribute:seed,rng_kind,version,time,frame_rowsandmade_by(see "Seeding" indraw()).NULLfor a sample from an earlier version of drawn, which recorded none. The print shows the seed, the version and the date.
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)
#> effective n 40 (Kish, from the weights alone)
#> drawn with seed 1, by drawn 0.2.0.9000 on 2026-11-18
#>
#> 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