# Note that one of the replicates has every factor equal to 1
# Also note that this matches Table 1 in Ash (2014)
make_sdr_replicate_factors(
n = 4,
target_number_of_replicates = 4,
use_normal_hadamard = TRUE
)
# Note the difference when using a non-normal Hadamard matrix
rep_factors <- make_sdr_replicate_factors(
n = 4,
target_number_of_replicates = 4,
use_normal_hadamard = FALSE
)
print(rep_factors)
# These replicate factors are equivalent
# to the SD2 variance estimator
tcrossprod(rep_factors - 1)
# Compare to the quadratic form of the SD2 estimator
sd2_quad_form <- make_quad_form_matrix(
variance_estimator = "SD2",
cluster_ids = matrix(1:4, ncol = 1),
sort_order = matrix(1:4, ncol = 1)
)
print(sd2_quad_form)
Run the code above in your browser using DataLab