View source: R/tidy_parglm_robust.R
| tidy_parglm_robust | R Documentation |
A drop-in tidy_fun for tbl_regression that
computes heteroskedasticity-consistent (HC) or cluster-robust confidence
intervals via sandwich and lmtest.
tidy_parglm_robust(
x,
vcov. = "HC3",
conf.int = TRUE,
conf.level = 0.95,
exponentiate = FALSE,
...
)
x |
a |
vcov. |
the robust variance-covariance estimator. A string is passed
as the |
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 |
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), ...))
a data.frame with columns term, estimate,
std.error, statistic, p.value, and (when
conf.int = TRUE) conf.low and conf.high.
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)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.