Skip to content

Commit

Permalink
Adj to tests to improve passing
Browse files Browse the repository at this point in the history
  • Loading branch information
ngreifer committed Jul 27, 2024
1 parent dd69ea4 commit 5945481
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 3 deletions.
7 changes: 5 additions & 2 deletions tests/testthat/test-glm_weightit.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
test_that("No weights", {
skip_if_not_installed("sandwich")
skip_if_not_installed("brglm2")

eps <- if (capabilities("long.double")) 1e-5 else 1e-1

test_data <- readRDS(test_path("fixtures", "test_data.rds"))
Expand Down Expand Up @@ -71,6 +74,8 @@ test_that("No weights", {
})

test_that("Binary treatment", {
skip_if_not_installed("fwb")

eps <- if (capabilities("long.double")) 1e-5 else 1e-1

test_data <- readRDS(test_path("fixtures", "test_data.rds"))
Expand All @@ -81,8 +86,6 @@ test_that("Binary treatment", {
include.obj = TRUE)
})

expect_M_parts_okay(W)

expect_no_condition({
fit0 <- glm_weightit(Y_C ~ A * (X1 + X2 + X3 + X4 + X5 + X6 + X7 + X8 + X9),
data = test_data, weightit = W)
Expand Down
7 changes: 7 additions & 0 deletions tests/testthat/test-method_glm.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
test_that("Binary treatment", {
skip_if_not_installed("rootSolve")
skip_if_not_installed("cobalt")
skip_if_not_installed("brglm2")
skip_if_not_installed("logistf")

eps <- if (capabilities("long.double")) 1e-5 else 1e-1

test_data <- readRDS(test_path("fixtures", "test_data.rds"))
Expand Down Expand Up @@ -210,6 +215,8 @@ test_that("Binary treatment", {
})

test_that("Ordinal treatment", {
skip_if_not_installed("rootSolve")

eps <- if (capabilities("long.double")) 1e-5 else 1e-1

test_data <- readRDS(test_path("fixtures", "test_data.rds"))
Expand Down
7 changes: 7 additions & 0 deletions tests/testthat/test-multinom_weightit.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
test_that("No weights", {
skip_if_not_installed("sandwich")
skip_if_not_installed("mlogit")
skip_if_not_installed("dfidx")

eps <- if (capabilities("long.double")) 1e-5 else 1e-1

test_data <- readRDS(test_path("fixtures", "test_data.rds"))
Expand Down Expand Up @@ -56,6 +60,9 @@ test_that("No weights", {
})

test_that("Binary treatment", {
skip_if_not_installed("mlogit")
skip_if_not_installed("dfidx")

eps <- if (capabilities("long.double")) 1e-5 else 1e-1

test_data <- readRDS(test_path("fixtures", "test_data.rds"))
Expand Down
5 changes: 5 additions & 0 deletions tests/testthat/test-ordinal_weightit.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
test_that("No weights", {
skip_if_not_installed("MASS")
skip_if_not_installed("sandwich")

eps <- if (capabilities("long.double")) 1e-5 else 1e-1

test_data <- readRDS(test_path("fixtures", "test_data.rds"))
Expand Down Expand Up @@ -85,6 +88,8 @@ test_that("No weights", {
})

test_that("Binary treatment", {
skip_if_not_installed("MASS")

eps <- if (capabilities("long.double")) 1e-5 else 1e-1

test_data <- readRDS(test_path("fixtures", "test_data.rds"))
Expand Down
2 changes: 1 addition & 1 deletion vignettes/estimating-effects.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ pre code {
</style>
```
```{r, include = FALSE}
knitr::opts_chunk$set(echo = TRUE, eval=T)
knitr::opts_chunk$set(echo = TRUE, eval = TRUE)
options(width = 200, digits= 4)
me_ok <- requireNamespace("marginaleffects", quietly = TRUE)
Expand Down

0 comments on commit 5945481

Please sign in to comment.