Skip to contents

Fits 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.

Value

An R6 class generator.

Super classes

StrategyBase -> StrategyBinomial -> StrategyBinomialFirth

Methods

Inherited methods


StrategyBinomialFirth$new()

Create a Firth-penalized quasibinomial count strategy.

Usage

StrategyBinomialFirth$new(modelstr, model_name = "binomial_firth_nested")

Arguments

modelstr

right-hand-side model formula, for example "~ group_"

model_name

model identity


StrategyBinomialFirth$clone()

The objects of this class are cloneable with this method.

Usage

StrategyBinomialFirth$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

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