Sandwich variance summed over clusters with the G/(G-1)
correction and a t(G-1) reference. Mirrors morie.fn.clstcr.
Examples
set.seed(1)
n <- 3000
x <- stats::rnorm(n)
e <- pmin(pmax(1/(1 + exp(-x)), 0.05), 0.95)
tr <- as.numeric(stats::runif(n) < e)
y <- x + stats::rnorm(n) + 3 * tr
L <- stats::rnorm(n)
a <- as.numeric(stats::runif(n) < 1/(1 + exp(-1.5 * L)))
morie_g_formula(y, a, L)
#> $EY1
#> [1] 1.46452
#>
#> $EY0
#> [1] 1.413564
#>
#> $ate
#> [1] 0.05095646
#>
#> $n
#> [1] 3000
#>
morie_cluster_robust_effect(y = y, d = a, cluster = e)
#> $estimate
#> [1] 0.06747841
#>
#> $se_cluster
#> [1] 0.08617385
#>
#> $se_naive
#> [1] 0.08574931
#>
#> $p_value
#> [1] 0.4336599
#>
#> $n_clusters
#> [1] 2990
#>
#> $n
#> [1] 3000
#>
