-
-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Prepare CRAN submission #691
Conversation
should I submit? |
Let me try to fix failing tests first. Might be because we do no longer import marginaleffects from GitHub (no |
@mattansb Do you know what's going on here, why this test suddenly fails? data("mtcars")
mtcars$cyl <- factor(mtcars$cyl)
mod <- rstanarm::stan_glm(mpg ~ cyl + hp * am, data = mtcars, refresh = 0)
mfx <- marginaleffects::avg_slopes(mod, by = "am")
mfx_samps <- as.data.frame(t(attr(mfx, "posterior_draws")))
res <- hdi(mfx, ci = c(0.8, 0.9))
expect_identical(
as.data.frame(res[1:3]),
data.frame(
term = c(
"am", "am", "am", "am", "cyl", "cyl",
"cyl", "cyl", "cyl", "cyl", "cyl", "cyl",
"hp", "hp", "hp", "hp"
),
contrast = c(
"1 - 0", "1 - 0", "1 - 0", "1 - 0",
"6 - 4", "6 - 4", "8 - 4", "8 - 4",
"6 - 4", "6 - 4", "8 - 4", "8 - 4",
"dY/dX", "dY/dX", "dY/dX", "dY/dX"
),
am = c(
0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0,
1, 1
), stringsAsFactors = FALSE
)
) Failing tests:
The |
Something is wrong - the am column should appear, as it does in data("mtcars")
mtcars$cyl <- factor(mtcars$cyl)
mod <- rstanarm::stan_glm(mpg ~ cyl + hp * am, data = mtcars, refresh = 0)
mfx <- marginaleffects::avg_slopes(mod, by = "am")
insight::get_datagrid(mfx)
#> term contrast am
#> 1 am 1 - 0 0
#> 2 am 1 - 0 1
#> 3 cyl 6 - 4 0
#> 4 cyl 8 - 4 0
#> 5 cyl 6 - 4 1
#> 6 cyl 8 - 4 1
#> 7 hp dY/dX 0
#> 8 hp dY/dX 1 When I run it, I do get all columns: bayestestR::hdi(mfx, ci = c(0.8, 0.9))
#> Highest Density Interval
#>
#> term | contrast | am | 80% HDI | 90% HDI
#> --------------------------------------------------------
#> am | 1 - 0 | 0.00 | [ 2.51, 6.27] | [ 1.93, 6.77]
#> am | 1 - 0 | 1.00 | [ 2.63, 6.10] | [ 1.97, 6.40]
#> cyl | 6 - 4 | 0.00 | [-5.95, -1.89] | [-6.55, -1.21]
#> cyl | 8 - 4 | 0.00 | [-7.33, 0.00] | [-8.13, 1.29]
#> cyl | 6 - 4 | 1.00 | [-5.95, -1.89] | [-6.55, -1.21]
#> cyl | 8 - 4 | 1.00 | [-7.33, 0.00] | [-8.13, 1.29]
#> hp | dY/dX | 0.00 | [-0.08, -0.02] | [-0.08, -0.01]
#> hp | dY/dX | 1.00 | [-0.06, -0.02] | [-0.07, -0.02]
|
Something is wrong here - the tested code you posted does not match the output or the failed test... |
Are you using the dev-version of {marginaleffects}? |
Ok, this works only with the dev version of marginaleffects, not the CRAN version. I updated the test to skip if package version is 0.24.0 or lower. If checks pass, we can submit @DominiqueMakowski |
Ah, I see. I thought this was already on CRAN. Oops. |
@DominiqueMakowski please submit. |
Remember to pull the latest changes from here ;-) |
submitted |
on its way to CRAN. |
No description provided.