Skip to content

Commit d15749b

Browse files
authored
Unit level DF for Satterthwaite and Kenward-Roger (#1070)
Fixes #1069
1 parent bb94d6c commit d15749b

2 files changed

Lines changed: 24 additions & 1 deletion

File tree

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Type: Package
22
Package: insight
33
Title: Easy Access to Model Information for Various Model Objects
4-
Version: 1.2.0.9
4+
Version: 1.2.0.10
55
Authors@R:
66
c(person(given = "Daniel",
77
family = "Lüdecke",

tests/testthat/test-lmer.R

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,29 @@ test_that("get_df", {
8282
ignore_attr = TRUE,
8383
tolerance = 1e-4
8484
)
85+
86+
skip_if_not_installed("lmerTest")
87+
# per observation df
88+
data(mtcars)
89+
mod <- lme4::lmer(am ~ hp + (1 | cyl), data = mtcars)
90+
out1 <- get_df(mod, type = "satterthwaite", df_per_obs = TRUE, data = mtcars)
91+
out2 <- get_df(mod, type = "satterthwaite", df_per_obs = FALSE)
92+
expect_equal(
93+
out1,
94+
c(
95+
1.75657, 1.75657, 1.89121, 1.75657, 1.80609, 1.78946, 2.95048,
96+
2.31532, 1.87196, 1.69622, 1.69622, 1.84694, 1.84694, 1.84694,
97+
2.13913, 2.29991, 2.59236, 2.2466, 2.50664, 2.26337, 1.85365,
98+
1.68312, 1.68312, 2.95048, 1.80609, 2.2466, 1.91138, 1.73945,
99+
3.50471, 1.80609, 6.61056, 1.76271
100+
),
101+
tolerance = 1e-3
102+
)
103+
expect_equal(
104+
out2,
105+
c(`(Intercept)` = 3.99802, hp = 29.3951),
106+
tolerance = 1e-3
107+
)
85108
})
86109

87110
test_that("n_parameters", {

0 commit comments

Comments
 (0)