@@ -181,6 +181,7 @@ test_that("predictions, bmrs with special response formula", {
181181 skip_if_offline()
182182 skip_if_not_installed(" httr2" )
183183 skip_if_not_installed(" brms" )
184+ skip_if_not_installed(" marginaleffects" , minimum_version = " 0.28.0.21" )
184185
185186 m <- insight :: download_model(" brms_ipw_1" )
186187 skip_if(is.null(m ))
@@ -190,6 +191,29 @@ test_that("predictions, bmrs with special response formula", {
190191 expect_identical(dim(out ), c(1L , 10L ))
191192})
192193
194+
195+ test_that(" modelbased, tidiers work" , {
196+ skip_if_not_installed(" marginaleffects" , minimum_version = " 0.28.0.21" )
197+ skip_if_not_installed(" modelbased" )
198+ skip_if(getRversion() < " 4.5.0" )
199+
200+ data(penguins )
201+ m <- lm(bill_len ~ island * sex + bill_dep + species , data = penguins )
202+
203+ # # FIXME: Need to wait for https://github.com/vincentarelbundock/marginaleffects/issues/1573
204+ out <- modelbased :: estimate_contrasts(m , " island" , by = " sex" , comparison = ratio ~ pairwise )
205+ expect_named(
206+ out ,
207+ c(" Level1" , " Level2" , " sex" , " Ratio" , " SE" , " CI_low" , " CI_high" , " t" , " df" , " p" )
208+ )
209+ expect_identical(dim(out ), c(6L , 10L ))
210+
211+ out <- modelbased :: estimate_contrasts(m , " island" , by = " sex" , comparison = ratio ~ inequality )
212+ expect_named(out , c(" sex" , " Mean_Ratio" , " SE" , " CI_low" , " CI_high" , " z" , " p" ))
213+ expect_identical(dim(out ), c(2L , 7L ))
214+ })
215+
216+
193217# # TODO: check this test locally
194218
195219# Following test may fail on CI, probably due to scoping issues?
@@ -210,6 +234,7 @@ test_that("predictions, using bayestestR #1063", {
210234 skip_if_offline()
211235 skip_if_not_installed(" httr2" )
212236 skip_if_not_installed(" brms" )
237+ skip_if_not_installed(" marginaleffects" , minimum_version = " 0.28.0.21" )
213238
214239 m <- insight :: download_model(" brms_mixed_3" )
215240 skip_if(is.null(m ))
0 commit comments