Calculate replicate weights and summary statistics
Source:R/calc_replicate_weights.R
calc_replicate_weights.RdTakes the output of cluster_gen to calculate the replicate
weights as well as some summary statistics
Details
Replicate weights can be calculated using the Jackknife for unstratified two-stage sample designs or Balanced Repeated Replication (BRR) with or without Fay's modification.
According to OECD (2015), PISA uses the Fay method with a factor of 0.5.
This is why k = .5 by default.
Note
This function is essentially a big wrapper for replicate_var,
applying that function on each element of an output of cluster_gen.
References
OECD (2015). Pisa Data Analysis Manual. Rust, K. F., & Rao, J. N. K. (1996). Variance estimation for complex surveys using replication techniques. Statistical methods in medical research, 5(3), 283-310.
Examples
data <- cluster_gen(c(3, 50))
#> ── Hierarchical structure ──────────────────────────────────────────────────────
#> Sampled structure
#> Generating questionnaires for schools
#> Total respondents: 150 (50 * 3)
#> school1 (50 students)
#> school2 (50 students)
#> school3 (50 students)
#> ── Information on sampling weights ─────────────────────────────────────────────
#> - Calculating PPS weights at the school level
#> final.student.weight should add up to the number of students in the population (150)
calc_replicate_weights(data, "Jackknife")
#> $school
#> $school[[1]]
#> q1 q2
#> mean -0.04662409 0.08339896
#> SE 0.13158022 0.15485733
#>
#> $school[[2]]
#> q1 q2
#> mean 0.2250988 -0.009418086
#> SE 0.1325436 0.135784418
#>
#> $school[[3]]
#> q1 q2
#> mean 0.1218017 0.03878344
#> SE 0.1032926 0.14206916
#>
#>
calc_replicate_weights(data, "BRR")
#> $school
#> $school[[1]]
#> q1 q2
#> mean -0.04662409 0.08339896
#> SE 0.09125537 0.16933045
#>
#> $school[[2]]
#> q1 q2
#> mean 0.2250988 -0.009418086
#> SE 0.1130681 0.123950275
#>
#> $school[[3]]
#> q1 q2
#> mean 0.1218017 0.03878344
#> SE 0.1083591 0.14655101
#>
#>
calc_replicate_weights(data, "BRR Fay")
#> $school
#> $school[[1]]
#> q1 q2
#> mean -0.04662409 0.08339896
#> SE 0.10559729 0.19268641
#>
#> $school[[2]]
#> q1 q2
#> mean 0.2250988 -0.009418086
#> SE 0.1416689 0.135769772
#>
#> $school[[3]]
#> q1 q2
#> mean 0.1218017 0.03878344
#> SE 0.1075772 0.11295015
#>
#>