From 91f4d9a732bdb7fd281292d254a621e5bc537e71 Mon Sep 17 00:00:00 2001 From: Ben Bolker Date: Sun, 27 Oct 2024 13:34:48 -0400 Subject: [PATCH] allow 'parametric' (ignored) in tidy.stanreg (fixes #153) --- DESCRIPTION | 1 + R/rstanarm_tidiers.R | 3 ++- tests/testthat/test-rstanarm.R | 16 +++++++++++++++- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index d1c9bb2..f342e8c 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -68,6 +68,7 @@ Suggests: MCMCglmm, mediation, mgcv, + mice, ordinal, pander, pbkrtest, diff --git a/R/rstanarm_tidiers.R b/R/rstanarm_tidiers.R index 88170f5..b9e4b0a 100644 --- a/R/rstanarm_tidiers.R +++ b/R/rstanarm_tidiers.R @@ -94,7 +94,8 @@ tidy.stanreg <- function(x, conf.method=c("quantile","HPDinterval"), exponentiate = FALSE, ...) { - check_dots(...) + ## ignore 'parametric', which may be passed by mice:::summary.mira() + check_dots(..., .ignore = "parametric") conf.method <- match.arg(conf.method) std.error <- estimate <- NULL ## fool code checker/NSE miss_effects <- missing(effects) diff --git a/tests/testthat/test-rstanarm.R b/tests/testthat/test-rstanarm.R index 2d01893..aedd4f7 100644 --- a/tests/testthat/test-rstanarm.R +++ b/tests/testthat/test-rstanarm.R @@ -48,5 +48,19 @@ if (suppressPackageStartupMessages(require(rstanarm, quietly = TRUE))) { expect_equal(td1e$conf.high, exp(td1$conf.high)) expect_equal(td1e$std.error, exp(td1$estimate)*td1$std.error) }) - + + ## GH 153 + if (requireNamespace("mice", quietly = TRUE)) { + test_that("mice imputed data", { + data(nhanes) + imp <- mice(nhanes, m = 3, print = FALSE) + suppressWarnings( + capture.output(ms <- with(imp, + stan_glm(age ~ bmi + chl))) + ) + expect_is(summary(pool(ms)), "mipo.summary") + }) + } + } ## rstanarm available +