Skip to contents

\((1 - n/N)S_b^2/n\) with n the number of CLUSTERS, not elements. 1000 units in 25 villages is 25 degrees of freedom, and treating it as 1000 independent draws understates the standard error by the square root of the design effect \(1 + (\bar m - 1)\rho\). Both are computed, so the cost of clustering is a number. Mirrors morie.fn.cluvar.

Usage

morie_cluster_variance(y, cluster, N = NULL)

Arguments

y

element-level values.

cluster

cluster identifiers.

N

number of clusters in the population, for the fpc.

Value

list: mean, variance, se, n_clusters, n_elements, mean_cluster_size, icc, deff, effective_n, naive_se, se_inflation, method.

Examples

set.seed(1)
y <- rnorm(200) + rep(rnorm(20), each = 10)
morie_cluster_variance(y, rep(1:20, each = 10))$deff
#> [1] 6.169258