Skip to content

Commit 983be75

Browse files
committed
satterthwaite
1 parent bb945e6 commit 983be75

File tree

5 files changed

+23
-23
lines changed

5 files changed

+23
-23
lines changed

NAMESPACE

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,8 @@ S3method(ci,systemfit)
114114
S3method(ci,varest)
115115
S3method(ci,zerocount)
116116
S3method(ci,zeroinfl)
117+
S3method(ci_kenward,default)
118+
S3method(ci_kenward,glmmTMB)
117119
S3method(cluster_discrimination,cluster_analysis)
118120
S3method(cluster_discrimination,default)
119121
S3method(cluster_performance,dbscan)
@@ -138,7 +140,6 @@ S3method(display,parameters_pca_summary)
138140
S3method(display,parameters_sem)
139141
S3method(display,parameters_simulate)
140142
S3method(display,parameters_standardized)
141-
S3method(dof_satterthwaite,lmerMod)
142143
S3method(equivalence_test,MixMod)
143144
S3method(equivalence_test,estimate_contrasts)
144145
S3method(equivalence_test,estimate_means)

R/ci_satterthwaite.R

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,18 @@
22
#' @export
33
ci_satterthwaite <- function(model, ci = 0.95, ...) {
44
df_satter <- dof_satterthwaite(model)
5+
if (inherits(model, "glmmTMB")) {
6+
component <- "conditional"
7+
} else {
8+
component <- "all"
9+
}
510
out <- lapply(ci, function(i) {
611
.ci_dof(
712
model = model,
813
ci = i,
914
dof = df_satter,
1015
effects = "fixed",
11-
component = "all",
16+
component = component,
1217
method = "satterthwaite",
1318
...
1419
)

R/dof_satterthwaite.R

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,5 @@
11
#' @rdname p_value_satterthwaite
22
#' @export
33
dof_satterthwaite <- function(model) {
4-
UseMethod("dof_satterthwaite")
5-
}
6-
7-
8-
#' @export
9-
dof_satterthwaite.lmerMod <- function(model) {
10-
insight::check_if_installed("lmerTest")
11-
12-
parameters <- insight::find_parameters(model, effects = "fixed", flatten = TRUE)
13-
lmerTest_model <- lmerTest::as_lmerModLmerTest(model)
14-
s <- summary(lmerTest_model)
15-
16-
stats::setNames(as.vector(s$coefficients[, 3]), parameters)
4+
insight::get_df(model, "satterthwaite")
175
}

man/p_value_kenward.Rd

Lines changed: 3 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/testthat/test-model_parameters_df_method.R

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,12 @@ mp2 <- model_parameters(model, digits = 5, ci_method = "s", effects = "fixed")
2929
mp3 <- model_parameters(model, digits = 5, ci_method = "kr", effects = "fixed")
3030
mp4 <- model_parameters(model, digits = 5, ci_method = "wald", effects = "fixed")
3131
mp5 <- model_parameters(model3, digits = 5, ci_method = "kr", effects = "fixed")
32+
mp6 <- model_parameters(
33+
model3,
34+
digits = 5,
35+
ci_method = "satterthwaite",
36+
effects = "fixed"
37+
)
3238

3339
test_that("model_parameters, ci_method default (residual)", {
3440
expect_equal(
@@ -85,6 +91,8 @@ test_that("model_parameters, ci_method satterthwaite", {
8591
c(24.57489, 4.93385, -1.91805, -0.05477, -2.96368, -4.41987, -0.16904, -0.05117),
8692
tolerance = 1e-3
8793
)
94+
expect_equal(mp2$SE, mp6$SE, tolerance = 1e-3)
95+
expect_equal(mp2$df_error, mp6$df_error, tolerance = 1e-3)
8896
})
8997

9098
test_that("model_parameters, ci_method kenward", {
@@ -114,13 +122,13 @@ test_that("model_parameters, ci_method kenward", {
114122

115123
expect_warning(expect_warning(expect_warning(
116124
{
117-
mp6 <- model_parameters(model4, digits = 5, ci_method = "kr", effects = "fixed")
125+
mp7 <- model_parameters(model4, digits = 5, ci_method = "kr", effects = "fixed")
118126
},
119127
regex = "Model was not fitted"
120128
)))
121129

122-
expect_equal(mp5$SE, mp6$SE, tolerance = 1e-3)
123-
expect_equal(mp5$df_error, mp6$df_error, tolerance = 1e-3)
130+
expect_equal(mp5$SE, mp7$SE, tolerance = 1e-3)
131+
expect_equal(mp5$df_error, mp7$df_error, tolerance = 1e-3)
124132
})
125133

126134
test_that("model_parameters, ci_method wald (t)", {

0 commit comments

Comments
 (0)