library("matchatr")
set.seed(5)
n <- 2000
x <- rbinom(n, 1, 0.4)
eta <- cbind(control = 0, A = -1 + log(2) * x, B = -1.4 + log(2) * x)
prob <- exp(eta) / rowSums(exp(eta))
g <- apply(prob, 1, function(p) sample(c("control", "A", "B"), 1, prob = p))
d <- data.frame(g = g, x = x)
fit <- matcha(d, outcome = "g", exposure = "x",
design = unmatched_cc(), estimator = "polytomous",
reference = "control")
tidy(test_homogeneity(fit)) term estimate std.error conf.low conf.high statistic df p.value
<char> <num> <num> <num> <num> <num> <int> <num>
1: x 2.168761 0.2006846 1.809033 2.600022 0.6589249 1 0.4169398