
GLMM Inference for KK Designs with Count Response
Source:R/inference_count_KK_combined.R
InferenceCountKKGLMM.RdFits a Poisson GLMM for count responses under a KK matching-on-the-fly design. The random intercept per matched pair is integrated out via Gauss-Hermite quadrature.
When use_rcpp = TRUE (default) the likelihood is maximised by an internal
Rcpp routine. Set use_rcpp = FALSE to fall back to glmmTMB.
Model. \(Y_{ij} \mid b_i \sim \mathrm{Poisson}(\mu_{ij})\) with \(\log \mu_{ij} = X_{ij}'\beta + \beta_T \cdot W_{ij} + b_i\), where \(i\) indexes matched pairs, \(j \in \{1, 2\}\) the two subjects within a pair, \(W_{ij}\) is the treatment indicator, and \(b_i \sim \mathcal{N}(0, \sigma_b^2)\) is a pair-level random intercept absorbing within-pair correlation induced by matching. \(\beta_T\) is a log-rate (log relative risk) treatment effect: \(\exp(\hat\beta_T)\) is the estimated rate ratio. The random effect is integrated out of the marginal likelihood by (non-adaptive) Gauss-Hermite quadrature with 60 fixed nodes rather than a Laplace approximation.
Likelihood tier. likelihood_tier = "full": both Wald
(see Wald standard error below) and likelihood-ratio testing types are
available. The likelihood-ratio, score and gradient CIs/p-values are the
GLMM's own model-based tests, as in the other KK GLMM classes; they are not
widened against the Wald result (before 1.0.5 each reported the larger
p-value / wider interval of the model test and the Wald test).
Wald standard error. The model standard error is from the inverse
of the observed information (the negative Hessian of the quadrature
marginal log-likelihood in \((\beta, \log\sigma_b)\) at the MLE; with
use_rcpp = FALSE, glmmTMB's). Outside resampling it is then
replaced by the delete-one jackknife standard error (automatic unit) when
that is larger, so the Wald standard error is the larger of the two (on
three simulated n = 60 KK14 fits 9% to 26% above the model value). The same
standard error is used by every Wald interval and p-value
(compute_asymp_*() and compute_wald_*()) and by
InferenceSuite's se column.
Assumptions. Count response modeled as conditionally Poisson given the random intercept (equidispersion conditional on \(b_i\)); pair-level random effects independent across pairs; a KK matching-on-the-fly design.
Small-sample behaviour
How fast the size (and coverage) error of each procedure is expected to vanish as the
effective sample size \(n_{eff}\) grows, from EDI's convergence-rate registry
(inference_convergence_expectation()). Exact procedures are valid at every
n by construction; the others are asymptotic, so a small-sample excess is expected, and
its constant is not given by an order. The table is the expectation for a balanced
complete-randomization design; it is not a measured size. Reference keys are explained
under References.
| Procedure | Regime | Error order | Effective n | Regularity | Basis | References |
rand | finite sample | exact | pairs + reservoir | regular | theory | [Fisher1935], [LehmannRomano2005] |
wald | asymptotic | unknown | pairs + reservoir | variance component | unknown | [SelfLiang1987], [StramLee1994] |
jackknife | asymptotic | unknown | pairs + reservoir | variance component | unknown | [SelfLiang1987], [StramLee1994] |
score | asymptotic | unknown | pairs + reservoir | variance component | unknown | [SelfLiang1987], [StramLee1994] |
lik_ratio | asymptotic | unknown | pairs + reservoir | variance component | unknown | [SelfLiang1987], [StramLee1994] |
gradient | asymptotic | unknown | pairs + reservoir | variance component | unknown | [SelfLiang1987], [StramLee1994] |
lik_ratio_bartlett_approx | asymptotic | unknown | pairs + reservoir | variance component | unknown | [SelfLiang1987], [StramLee1994] |
lik_ratio_bartlett_exact | asymptotic | unknown | pairs + reservoir | variance component | unknown | [SelfLiang1987], [StramLee1994] |
param_boot | asymptotic | unknown | pairs + reservoir | variance component | unknown | [SelfLiang1987], [StramLee1994] |
param_boot_direct | asymptotic | unknown | pairs + reservoir | variance component | unknown | [SelfLiang1987], [StramLee1994] |
bootstrap | asymptotic | unknown | pairs + reservoir | variance component | unknown | [SelfLiang1987], [StramLee1994] |
bayes_boot | asymptotic | unknown | pairs + reservoir | variance component | unknown | [SelfLiang1987], [StramLee1994] |
rand_bootstrap | asymptotic | unknown | pairs + reservoir | variance component | unknown | [SelfLiang1987], [StramLee1994] |
The point estimate's bias is of order \(O(n_{eff}^{-1})\) (assumed default: [CoxSnell1968]).
Rows with order unknown: no rate is known for this class and procedure, so none is claimed; the cited works describe the non-standard limit, not a rate. Expect a small-sample excess of unquantified size.
Regularity variance component: a random-effect variance near zero is a non-standard limit that affects the standard tests.
The procedure list is by declared capability; an object can still report a procedure
(for example a Bartlett correction) as unavailable through get_supported_testing_types().
References
Kapelner, A. and Krieger, A. M. (2014). Matching on-the-fly: Sequential
allocation with higher power and efficiency. Biometrics, 70(2),
378-388. doi:10.1111/biom.12148
. (KK14 in REFERENCES.md.)
[Fisher1935] Fisher, R. A. (1935). The Design of Experiments. Oliver and Boyd.
[LehmannRomano2005] Lehmann, E. L., and Romano, J. P. (2005). Testing Statistical Hypotheses (3rd ed.). Springer.
[SelfLiang1987] Self, S. G., and Liang, K.-Y. (1987). "Asymptotic Properties of Maximum Likelihood Estimators and Likelihood Ratio Tests under Nonstandard Conditions." Journal of the American Statistical Association, 82(398), 605-610.
[StramLee1994] Stram, D. O., and Lee, J. W. (1994). "Variance Components Testing in the Longitudinal Mixed Effects Model." Biometrics, 50(4), 1171-1177.
[CoxSnell1968] Cox, D. R., and Snell, E. J. (1968). "A General Definition of Residuals." Journal of the Royal Statistical Society: Series B, 30(2), 248-265 (discussion 265-275).
See also
Analogous Python API for Poisson/count GLMs: statsmodels discrete models. Generalized linear model and Gauss-Hermite quadrature (orientation).
Super class
Inference -> InferenceCountKKGLMM
Methods
Public methods
+ inherited public methods from Inference
Inference$capabilities()Inference$clear_randomization_cache()Inference$compute_exact_confidence_interval()Inference$compute_exact_two_sided_pval_for_treatment_effect()Inference$duplicate()Inference$get_analysis_data()Inference$get_covariates()Inference$get_design_object()Inference$get_estimand()Inference$get_model_formula()Inference$get_nonestimable_reason()Inference$get_nonestimable_stage()Inference$get_optimization_alg()Inference$get_procedure_validity()Inference$get_response()Inference$get_response_type()Inference$get_summary()Inference$get_supported_estimands()Inference$get_treatment()Inference$is_nonestimable()Inference$set_estimand()Inference$set_optimization_alg()Inference$set_seed()Inference$supports()
InferenceCountKKGLMM$new()
Initialize a KK Poisson-GLMM inference object for a matched-pair KK design with a count response and prepare the matched-pair random-intercept likelihood machinery; see the class topic for the model.
Usage
InferenceCountKKGLMM$new(
des_obj,
model_formula = NULL,
use_rcpp = TRUE,
optimization_alg = NULL,
verbose = FALSE,
smart_cold_start_default = NULL
)Arguments
des_objA completed KK matching-on-the-fly
Designobject (DesignSeqOneByOneKK14or subclass) with a count response.model_formulaOptional formula for covariate adjustment. If
NULL(default), the formula from the design object is used.use_rcppLogical. If
TRUE(default), maximize the Gauss-Hermite-quadrature marginal likelihood with the internal Rcpp Poisson-GLMM routine; ifFALSE, fall back to glmmTMB.optimization_algOptimization algorithm passed to the likelihood maximizer. If
NULL(default), an algorithm is dispatched via the package's optimizer policy.verboseWhether to print progress messages.
smart_cold_start_defaultWhether to use smart starting values for the optimizer.
InferenceCountKKGLMM$compute_estimate()
Point estimate of the treatment log-rate coefficient \(\beta_T\) from a
Poisson GLMM with a matched-pair random intercept, fit by maximizing the
Gauss-Hermite-quadrature-integrated marginal likelihood (internal Rcpp routine when
use_rcpp = TRUE, else glmmTMB). See the class topic for the model form.
InferenceCountKKGLMM$compute_estimate_with_bootstrap_weights()
Recomputes the KK Poisson-GLMM treatment estimate under nonparametric/
Bayesian-bootstrap subject-or-block weights, refitting the weighted GLMM
(compute_weighted_glmm_bootstrap_estimate()). Standard error, degrees of
freedom, and the cached summary table are cleared/set to NA/Inf/
NULL since only the point estimate is meaningful under resampling weights.
Falls back to the unweighted point estimate when the weights are effectively
constant.
Usage
InferenceCountKKGLMM$compute_estimate_with_bootstrap_weights(
subject_or_block_weights,
estimate_only = FALSE
)Arguments
subject_or_block_weightsNumeric vector of nonnegative bootstrap replicate weights, one per subject or per matched block (KK match structure).
estimate_onlyIf
TRUE, compute only the weighted point estimate (this method never computes a weighted standard error regardless of this argument).
InferenceCountKKGLMM$compute_wald_confidence_interval()
Wald confidence interval for the treatment log-rate coefficient:
\(\hat\beta_T \pm t_{1-\alpha/2,\,df}\cdot \hat{se}(\hat\beta_T)\), using the
Wald standard error described in the class details (the larger of the
model-based and delete-one jackknife standard errors). See
InferenceAsymp for the shared contract.
InferenceCountKKGLMM$compute_wald_two_sided_pval()
Two-sided Wald p-value for \(H_0: \beta_T = \code{delta}\) vs. \(H_1: \beta_T \neq \code{delta}\), using the Wald standard error described in the class details (the larger of the model-based and delete-one jackknife standard errors).
InferenceCountKKGLMM$compute_lik_ratio_confidence_interval()
Likelihood-ratio confidence interval for the treatment log-rate coefficient, inverting the GLMM's profile likelihood-ratio test against \(\chi^2_1\).
InferenceCountKKGLMM$compute_lik_ratio_two_sided_pval()
Two-sided likelihood-ratio p-value for \(H_0: \beta_T = \code{delta}\), from the GLMM's profile likelihood-ratio test referred to \(\chi^2_1\).
InferenceCountKKGLMM$compute_asymp_confidence_interval()
Asymptotic confidence interval, dispatching on
self$get_testing_type() to compute_wald_confidence_interval(),
compute_lik_ratio_confidence_interval(), or the score or gradient test
inversion; any other testing type is an error. See InferenceAsymp for the shared
testing-type dispatch contract.
InferenceCountKKGLMM$compute_asymp_two_sided_pval()
Asymptotic two-sided p-value, dispatching on
self$get_testing_type() to compute_wald_two_sided_pval(),
compute_lik_ratio_two_sided_pval(), or the score or gradient test; any
other testing type is an error. See InferenceAsymp for the shared
testing-type dispatch contract.
Examples
# \donttest{
seq_des = DesignSeqOneByOneKK14$new(n = 10, response_type = 'count')
for (i in 1:10) {
seq_des$add_one_subject_to_experiment_and_assign(data.frame(x1 = rnorm(1), x2 = rnorm(1)))
}
seq_des$add_all_subject_responses(rpois(10, 2))
inf = InferenceCountKKGLMM$new(seq_des)
inf$compute_estimate()
#> [1] 0.1933671
# }