Firth-penalized quasibinomial detection-count strategy
Source:R/BinomialNested.R
StrategyBinomialFirth.RdFits detected and undetected child-feature counts like
StrategyBinomial, but replaces the fixed pseudo-count with
Firth's bias reduction: each count row gets \(h/2\) added to both outcomes,
where \(h\) is its hat value at the fitted probabilities, iterated to
convergence. The coefficients are Firth's penalized maximum-likelihood
estimates, finite under complete separation. vcov() and sigma()
are those of the quasibinomial fit to the adjusted counts, so the dispersion
is estimated from the scatter of the counts between samples.
Super classes
StrategyBase -> StrategyBinomial -> StrategyBinomialFirth
Methods
StrategyBinomialFirth$new()
Create a Firth-penalized quasibinomial count strategy.
Usage
StrategyBinomialFirth$new(modelstr, model_name = "binomial_firth_nested")Examples
dat <- data.frame(
group_ = factor(rep(c("A", "B"), each = 4)),
detected = c(0, 0, 0, 0, 4, 5, 3, 5),
undetected = c(5, 5, 5, 5, 1, 0, 2, 0)
)
strategy <- StrategyBinomialFirth$new("~ group_")
fit <- strategy$model_fun(dat)
coefficients(fit)
#> (Intercept) group_B
#> -3.713572 5.323010