share_weights() applies the generalized weight share method (Lavallee
2007): it turns a sample of one population into a weighted sample of a
second population linked to it. The rows of the result are units of the
target population, not the units that were selected.
Usage
share_weights(
x,
targets,
links,
by,
to,
within,
...,
multiplicity = NULL,
target_scope = c("reached", "population")
)Arguments
- x
An executed
tbl_sample, the sample of the source population.- targets
The target register: one row per target unit, in the scope named by
target_scope. Required, because a link table holds only linked units and so cannot describe a unit that has no link of its own.- links
The link table: one row per link between a source unit and a target unit. Duplicate rows are refused, because a link counted twice changes both the numerator and the denominator.
- by, to
Named character vectors matching the source sample and the target register to
links, in the same direction as a dplyr join:c(local_column = "links_column").- within
The target cluster, Lavallee's \(i\). Never inferred. Give a bare column of
targetsfor the ordinary clustered method,NULLto make every target unit its own cluster, orextend_links()to eliminate clusters by extending the links across them.- ...
Must be empty. Arguments after it are matched by exact name.
- multiplicity
The population multiplicity \(L_{ik}\): a bare column of
targets, orcomplete_links()to assert thatlinksis the complete population register and let samplyr count it. For links carrying an importance rather than a presence,weighted_links().- target_scope
What
targetsis."reached", the default, claims only a full roster of the clusters the sample reached."population"asserts that it enumerates the target population, and only that form supports checking for clusters that can never be reached.
Value
A tbl_sample whose rows are target units. .weight holds the
shared estimation weight, .unit_links the unit's population
multiplicity, and .cluster_links the cluster denominator used. Under
weighted_links() those two are .link_weight and
.cluster_link_weight instead, holding the same quantities on the
importance scale; only the pair belonging to the scale in use is emitted.
The recorded design still describes selection from the source population.
The weight
Every target unit in a target cluster reached by the sample receives the same weight, which is the source weight carried across the links and divided by the population number of links to that cluster:
$$w_i = \sum_j \frac{I(j \in S)}{\pi_j} \frac{L_{ji}}{L_i}$$
Assigning one weight per cluster is what makes unit-level and cluster-level estimates of the same total agree.
The denominator
multiplicity is where the statistical content sits, and it has no
default. The denominator is defined over the whole source population,
not over the sample, so counting the rows of a link table asserts that the
table is a complete register. That assertion is the classic source of bias
in this method, so it has to be made at the call site rather than guessed:
either name a column of targets holding the population multiplicity, or
state the assertion with complete_links().
Links need not be counted. weighted_links() replaces the 0/1 indicator
with a non-negative importance, which Lavallee section 4.5 shows costs no
theory as long as each target cluster totals more than zero. Counting is
the case where every link counts for one.
Coverage
A target cluster with no link to the source population can never be
reached, and the estimator understates totals by exactly its share. That is
Lavallee's Constraint 2.1, and it is detectable only when targets
enumerates the population, so it is recorded rather than warned about here
and reported at the analysis boundary.
A target unit inside a reached cluster with no link of its own is a different thing and is correct: it receives its cluster's weight. Producing a weight for exactly those units is one of the reasons to use this method.
See also
Other weight sharing:
complete_links(),
complete_weighted_links(),
extend_links(),
weighted_links()
Examples
dwellings <- data.frame(dwelling_id = 1:20, region = rep(1:2, each = 10))
sample <- sampling_design() |>
draw(n = 8) |>
execute(dwellings, seed = 1)
# Two people per dwelling, each linked to the one dwelling they live in.
people <- data.frame(
person_id = 1:40,
household = rep(1:20, each = 2)
)
links <- data.frame(dwelling_id = rep(1:20, each = 2), person_id = 1:40)
share_weights(
sample,
targets = people,
links = links,
by = c(dwelling_id = "dwelling_id"),
to = c(person_id = "person_id"),
within = household,
multiplicity = complete_links()
)
#> # A tbl_sample: 16 × 5
#> # Weights: shared, 2.5 [2.5, 2.5]
#> # Shared from: 8 sampled rows
#> person_id household .unit_links .cluster_links .weight
#> * <int> <int> <dbl> <dbl> <dbl>
#> 1 1 1 1 2 2.5
#> 2 2 1 1 2 2.5
#> 3 3 2 1 2 2.5
#> 4 4 2 1 2 2.5
#> 5 7 4 1 2 2.5
#> 6 8 4 1 2 2.5
#> 7 13 7 1 2 2.5
#> 8 14 7 1 2 2.5
#> 9 21 11 1 2 2.5
#> 10 22 11 1 2 2.5
#> 11 25 13 1 2 2.5
#> 12 26 13 1 2 2.5
#> 13 33 17 1 2 2.5
#> 14 34 17 1 2 2.5
#> 15 37 19 1 2 2.5
#> 16 38 19 1 2 2.5