tidy_parglm_robust: Tidy a parglm model with robust standard errors

View source: R/tidy_parglm_robust.R

tidy_parglm_robustR Documentation

Tidy a parglm model with robust standard errors

Description

A drop-in tidy_fun for tbl_regression that computes heteroskedasticity-consistent (HC) or cluster-robust confidence intervals via sandwich and lmtest.

Usage

tidy_parglm_robust(
  x,
  vcov. = "HC3",
  conf.int = TRUE,
  conf.level = 0.95,
  exponentiate = FALSE,
  ...
)

Arguments

x

a parglm (or glm) model object.

vcov.

the robust variance-covariance estimator. A string is passed as the type argument to vcovHC (e.g. "HC3"). A function is called as vcov.(x) and should return a covariance matrix (use this for cluster-robust SEs via vcovCL). A matrix is used directly. Defaults to "HC3".

conf.int

logical; whether to include confidence intervals.

conf.level

confidence level for the intervals.

exponentiate

logical; whether to exponentiate the estimate and confidence interval limits.

...

unused; present for compatibility with the tidy_fun interface of tbl_regression.

Details

Pass this function as tidy_fun to tbl_regression:

# HC3 (default)
tbl_regression(fit, tidy_fun = tidy_parglm_robust)

# HC1
tbl_regression(fit, tidy_fun = \(x, ...) tidy_parglm_robust(x, vcov. = "HC1", ...))

# Cluster-robust
tbl_regression(fit, tidy_fun = \(x, ...) tidy_parglm_robust(
  x, vcov. = \(m) sandwich::vcovCL(m, cluster = ~ cluster_var), ...))

Value

a data.frame with columns term, estimate, std.error, statistic, p.value, and (when conf.int = TRUE) conf.low and conf.high.

Examples

fp <- parglm(mpg ~ wt + hp, data = mtcars,
             control = parglm.control(nthreads = 1L))
if (requireNamespace("sandwich", quietly = TRUE) &&
    requireNamespace("lmtest",   quietly = TRUE)) {
  tidy_parglm_robust(fp)
}


parglm documentation built on July 6, 2026, 5:07 p.m.