Description Usage Arguments Value Examples
This function creates a tibble containing information pertaining to a set of weights. It includes sample size, weighted sample size, effective sample size, as well as loss and efficiency values.
1 | weight_stats(weight)
|
weight |
Single column of a data frame or vector of weights. |
A tibble containing unweighted and weighted sample size, effective sample size, and efficiency and loss values for the supplied weight data.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | data(demo_data)
wgts <-
iterake(
universe = universe(
data = demo_data,
category(
name = "Sex",
buckets = factor(
x = levels(demo_data[["Sex"]]),
levels = levels(demo_data[["Sex"]])
),
targets = c(0.4, 0.5),
sum.1 = TRUE
),
category(
name = "BirthYear",
buckets = c(1986:1990),
targets = rep(0.2, times = 5)
),
category(
name = "EyeColor",
buckets = c("brown", "green", "blue"),
targets = c(0.8, 0.1, 0.1)
),
category(
name = "HomeOwner",
buckets = c(TRUE, FALSE),
targets = c(3/4, 1/4)
)
)
)
weight_stats(wgts$weight)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.