Skip to content

Commit

Permalink
add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
strengejacke committed Feb 7, 2025
1 parent 430e134 commit 16e6cb3
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 0 deletions.
47 changes: 47 additions & 0 deletions tests/testthat/_snaps/transform_response.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# estimate_means, transform

Code
out
Output
Estimated Marginal Means
speed | Mean | SE | 95% CI | t(48)
------------------------------------------
4.00 | 2.16 | 0.15 | [1.86, 2.46] | 14.27
6.33 | 2.44 | 0.13 | [2.19, 2.69] | 19.34
8.67 | 2.72 | 0.10 | [2.52, 2.93] | 26.47
11.00 | 3.00 | 0.08 | [2.84, 3.17] | 36.44
13.33 | 3.29 | 0.07 | [3.15, 3.42] | 48.43
15.67 | 3.57 | 0.06 | [3.44, 3.70] | 56.46
18.00 | 3.85 | 0.07 | [3.71, 3.99] | 54.63
20.33 | 4.13 | 0.09 | [3.96, 4.31] | 47.64
22.67 | 4.41 | 0.11 | [4.20, 4.63] | 40.87
25.00 | 4.70 | 0.13 | [4.43, 4.96] | 35.61
Variable predicted: dist
Predictors modulated: speed
Predictions are on the log-scale (consider `transform=TRUE`).

---

Code
out1
Output
Estimated Marginal Means
speed | Mean | 95% CI | df
-------------------------------------
4.00 | 8.66 | [ 6.39, 11.74] | 48
6.33 | 11.48 | [ 8.91, 14.80] | 48
8.67 | 15.22 | [12.38, 18.72] | 48
11.00 | 20.18 | [17.09, 23.82] | 48
13.33 | 26.74 | [23.33, 30.65] | 48
15.67 | 35.45 | [31.22, 40.25] | 48
18.00 | 46.99 | [40.78, 54.14] | 48
20.33 | 62.28 | [52.32, 74.15] | 48
22.67 | 82.56 | [66.44, 102.58] | 48
25.00 | 109.43 | [83.94, 142.65] | 48
Variable predicted: dist
Predictors modulated: speed

2 changes: 2 additions & 0 deletions tests/testthat/test-transform_response.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ test_that("estimate_means, transform", {
),
tolerance = 1e-4
)
expect_snapshot(out)
out1 <- estimate_means(m, "speed", transform = TRUE)
expect_equal(
out1$Mean,
Expand All @@ -21,6 +22,7 @@ test_that("estimate_means, transform", {
),
tolerance = 1e-4
)
expect_snapshot(out1)
out2 <- estimate_means(m, "speed", transform = exp)
expect_equal(out1$Mean, out2$Mean, tolerance = 1e-4)
})
Expand Down

0 comments on commit 16e6cb3

Please sign in to comment.