Skip to content

Commit

Permalink
add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
strengejacke committed Sep 15, 2024
1 parent ca58398 commit 9cc9bd1
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions tests/testthat/test-p_function.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@ model <- lm(Sepal.Length ~ Species, data = iris)

test_that("p_function ci-levels", {
out <- p_function(model)
expect_equal(
out$CI_low,
c(
4.982759, 0.897132, 1.549132, 4.956774, 0.860384, 1.512384,
4.92192, 0.811093, 1.463093, 4.862126, 0.726531, 1.378531
),
tolerance = 1e-4
)

expect_identical(dim(out), c(12L, 5L))

Expand Down Expand Up @@ -32,6 +40,16 @@ test_that("p_function ci-levels", {
c(0.3, 0.3, 0.3, 0.6, 0.6, 0.6, 0.9, 0.9, 0.9),
tolerance = 1e-4
)

out <- p_function(model, vcov = "HC3")
expect_equal(
out$CI_low,
c(
4.989925, 0.901495, 1.548843, 4.971951, 0.869624, 1.511772,
4.947844, 0.826875, 1.462047, 4.906485, 0.753538, 1.376742
),
tolerance = 1e-4
)
})


Expand Down

0 comments on commit 9cc9bd1

Please sign in to comment.