Skip to content

Commit b5a313e

Browse files
less iter
1 parent 7b2895e commit b5a313e

File tree

2 files changed

+15
-15
lines changed

2 files changed

+15
-15
lines changed

tests/testthat/test-estimate_response.R

+9-9
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,31 @@
11
if (require("testthat") && require("modelbased") && require("rstanarm") && require("insight") && require("brms") && require("lme4")) {
22
test_that("estimate_response - Bayesian", {
3-
model <- rstanarm::stan_glm(mpg ~ wt + poly(cyl, 2, raw = TRUE), data = mtcars, refresh = 0, iter = 500, chains = 2)
3+
model <- rstanarm::stan_glm(mpg ~ wt + poly(cyl, 2, raw = TRUE), data = mtcars, refresh = 0, iter = 200, chains = 2)
44
estim <- estimate_response(model, seed = 333)
55
testthat::expect_equal(nrow(estim), nrow(mtcars))
66

7-
model <- rstanarm::stan_glm(mpg ~ wt * as.factor(gear), data = mtcars, refresh = 0, iter = 500, chains = 2)
7+
model <- rstanarm::stan_glm(mpg ~ wt * as.factor(gear), data = mtcars, refresh = 0, iter = 200, chains = 2)
88
estim <- estimate_response(model, data = "grid", seed = 333)
99
testthat::expect_equal(c(nrow(estim), ncol(estim)), c(43, 5))
1010

11-
model <- rstanarm::stan_glm(mpg ~ as.factor(gear) / wt, data = mtcars, refresh = 0, iter = 500, chains = 2)
11+
model <- rstanarm::stan_glm(mpg ~ as.factor(gear) / wt, data = mtcars, refresh = 0, iter = 200, chains = 2)
1212
estim <- estimate_response(model)
1313
testthat::expect_equal(c(nrow(estim), ncol(estim)), c(32, 5))
1414

15-
model <- rstanarm::stan_glm(Sepal.Width ~ Petal.Width, data = iris, refresh = 0, iter = 500, chains = 2)
15+
model <- rstanarm::stan_glm(Sepal.Width ~ Petal.Width, data = iris, refresh = 0, iter = 200, chains = 2)
1616
estim <- estimate_link(model, keep_draws = TRUE)
1717
draws <- reshape_draws(estim)
18-
testthat::expect_equal(c(nrow(draws), ncol(draws)), c(12500, 7))
18+
testthat::expect_equal(c(nrow(draws), ncol(draws)), c(5000, 7))
1919

2020
# Polr
21-
model <- rstanarm::stan_polr(Species ~ Petal.Width + Petal.Length, data = iris, refresh = 0, iter = 500, chains = 2, prior = rstanarm::R2(0.2, "mean"))
21+
model <- rstanarm::stan_polr(Species ~ Petal.Width + Petal.Length, data = iris, refresh = 0, iter = 200, chains = 2, prior = rstanarm::R2(0.2, "mean"))
2222
estim <- estimate_link(model, length = 5)
2323
testthat::expect_equal(c(nrow(estim), ncol(estim)), c(25, 5))
2424

2525
# Non-sampling algorithms
26-
model <- rstanarm::stan_glm(mpg ~ drat, data = mtcars, algorithm = "meanfield", refresh=0)
27-
estim <- estimate_link(model, keep_draws = TRUE)
28-
testthat::expect_equal(c(nrow(estim), ncol(estim)), c(25, 1004))
26+
# model <- rstanarm::stan_glm(mpg ~ disp, data = mtcars, algorithm = "meanfield", refresh=0)
27+
# estim <- estimate_link(model, keep_draws = TRUE)
28+
# testthat::expect_equal(c(nrow(estim), ncol(estim)), c(25, 1004))
2929

3030
# model <- brms::brm(mpg ~ drat, data = mtcars, algorithm = "meanfield", refresh=0)
3131
# estim <- estimate_link(model, keep_draws = TRUE)

tests/testthat/test-estimate_smooth.R

+6-6
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,17 @@ if (require("testthat") && require("modelbased") && require("rstanarm")) {
22
test_that("estimate_smooth", {
33
set.seed(333)
44

5-
model <- stan_gamm4(Sepal.Width ~ s(Petal.Length), data = iris, refresh = 0, iter = 2000, chains = 2, seed = 333)
6-
estim <- estimate_smooth(model)
7-
# testthat::expect_equal(c(nrow(estim), ncol(estim)), c(2, 6))
5+
# model <- rstanarm::stan_gamm4(Sepal.Width ~ s(Petal.Length), data = iris, refresh = 0, iter = 200, chains = 2, seed = 333)
6+
# estim <- estimate_smooth(model)
7+
# testthat::expect_equal(c(nrow(estim), ncol(estim)), c(2, 7))
88

9-
model <- stan_glm(Sepal.Width ~ poly(Petal.Length, 2), data = iris, refresh = 0, iter = 2000, chains = 2, seed = 333)
9+
model <- rstanarm::stan_glm(Sepal.Width ~ poly(Petal.Length, 2), data = iris, refresh = 0, iter = 200, chains = 2, seed = 333)
1010
estim <- estimate_smooth(model)
1111
testthat::expect_equal(c(nrow(estim), ncol(estim)), c(2, 6))
1212

13-
model <- stan_glm(Sepal.Width ~ Species * poly(Petal.Length, 2), data = iris, refresh = 0, iter = 2000, chains = 2, seed = 333)
13+
model <- rstanarm::stan_glm(Sepal.Width ~ Species * poly(Petal.Length, 2), data = iris, refresh = 0, iter = 200, chains = 2, seed = 333)
1414
estim <- estimate_smooth(model)
15-
# testthat::expect_equal(c(nrow(estim), ncol(estim)), c(4, 6))
15+
testthat::expect_equal(c(nrow(estim), ncol(estim)), c(8, 6))
1616
estim <- estimate_smooth(model, levels = "Species")
1717
testthat::expect_equal(ncol(estim), 7)
1818
})

0 commit comments

Comments
 (0)