Skip to content

Commit 7f821f1

Browse files
authored
Merge branch 'main' into strengejacke/issue1135
2 parents 72bc7cd + 9c4bc23 commit 7f821f1

File tree

7 files changed

+94
-76
lines changed

7 files changed

+94
-76
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Type: Package
22
Package: parameters
33
Title: Processing of Model Parameters
4-
Version: 0.28.1.3
4+
Version: 0.28.2.1
55
Authors@R:
66
c(person(given = "Daniel",
77
family = "Lüdecke",

NEWS.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
# parameters 0.28.2
2+
3+
## Bug fixes
4+
5+
* Updates tests to resolve issues with the latest version of the *fixest* package.
6+
17
# parameters 0.28.1
28

39
## Changes

R/methods_marginaleffects.R

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,13 @@ model_parameters.marginaleffects <- function(
4242
out <- insight::standardize_names(out, style = "easystats")
4343
}
4444

45+
# edge case: for avg_comparisons() with custom hypothesis, "term" and "hypothesis"
46+
# are identical columns, now both names "Parameter" - remove one
47+
param_cols <- which(colnames(out) == "Parameter")
48+
if (length(param_cols) > 1) {
49+
out[param_cols[-1]] <- NULL
50+
}
51+
4552
# in case data grid contained column names that are reserved words,
4653
# rename those back now...
4754
colnames(out) <- gsub("#####$", "", colnames(out))

tests/testthat/_snaps/model_parameters.fixest.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
# model_parameters.fixest
1+
# model_parameters.fixest-1
22

33
Code
44
model_parameters(m1, include_info = TRUE, verbose = FALSE)
55
Output
66
# Fixed Effects
77
8-
Parameter | Coefficient | SE | 95% CI | t(187) | p
8+
Parameter | Coefficient | SE | 95% CI | t(374) | p
99
-----------------------------------------------------------------
10-
time | 1.09 | 0.67 | [-0.23, 2.41] | 1.63 | 0.106
11-
phq4 | -3.66 | 0.67 | [-4.98, -2.34] | -5.45 | < .001
10+
time | 1.09 | 0.64 | [-0.17, 2.34] | 1.70 | 0.089
11+
phq4 | -3.66 | 0.41 | [-4.46, -2.86] | -8.95 | < .001
1212
1313
Model: QoL ~ time + phq4 (564 Observations)
14-
Sigma: 12.365 (df = 561)
14+
Sigma: 12.365 (df = 374)
1515
RMSE : 10.069
1616
r2: 0.743; ar2: 0.613; wr2: 0.180; war2: 0.175
1717

tests/testthat/_snaps/model_parameters.fixest_multi.md

Lines changed: 66 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -5,45 +5,45 @@
55
Output
66
# Petal.Width ~ x
77
8-
Parameter | Coefficient | SE | 95% CI | t(2) | p
9-
-------------------------------------------------------------
10-
x | 0.02 | 0.02 | [-0.06, 0.09] | 0.91 | 0.459
8+
Parameter | Coefficient | SE | 95% CI | t(146) | p
9+
---------------------------------------------------------------
10+
x | 0.02 | 0.02 | [-0.02, 0.05] | 0.90 | 0.369
1111
1212
# Sepal.Width ~ x
1313
14-
Parameter | Coefficient | SE | 95% CI | t(2) | p
15-
-------------------------------------------------------------
16-
x | 0.05 | 0.06 | [-0.22, 0.31] | 0.74 | 0.534
14+
Parameter | Coefficient | SE | 95% CI | t(146) | p
15+
---------------------------------------------------------------
16+
x | 0.05 | 0.03 | [-0.01, 0.10] | 1.56 | 0.120
1717
1818
# Petal.Width ~ x + Petal.Length
1919
20-
Parameter | Coefficient | SE | 95% CI | t(2) | p
21-
----------------------------------------------------------------
22-
x | 0.01 | 0.02 | [-0.07, 0.10] | 0.73 | 0.541
23-
Petal.Length | 0.23 | 0.07 | [-0.07, 0.53] | 3.34 | 0.079
20+
Parameter | Coefficient | SE | 95% CI | t(145) | p
21+
-------------------------------------------------------------------
22+
x | 0.01 | 0.02 | [-0.02, 0.05] | 0.89 | 0.376
23+
Petal.Length | 0.23 | 0.03 | [ 0.16, 0.30] | 6.67 | < .001
2424
2525
# Sepal.Width ~ x + Petal.Length
2626
27-
Parameter | Coefficient | SE | 95% CI | t(2) | p
28-
----------------------------------------------------------------
29-
x | 0.04 | 0.06 | [-0.22, 0.31] | 0.71 | 0.553
30-
Petal.Length | 0.30 | 0.06 | [ 0.05, 0.54] | 5.15 | 0.036
27+
Parameter | Coefficient | SE | 95% CI | t(145) | p
28+
-------------------------------------------------------------------
29+
x | 0.04 | 0.03 | [-0.01, 0.10] | 1.58 | 0.116
30+
Petal.Length | 0.30 | 0.06 | [ 0.18, 0.42] | 4.92 | < .001
3131
3232
# Petal.Width ~ x + Petal.Length + Sepal.Length
3333
34-
Parameter | Coefficient | SE | 95% CI | t(2) | p
35-
-----------------------------------------------------------------
36-
x | 0.01 | 0.02 | [-0.07, 0.10] | 0.74 | 0.539
37-
Petal.Length | 0.23 | 0.08 | [-0.11, 0.58] | 2.93 | 0.099
38-
Sepal.Length | -4.24e-03 | 0.03 | [-0.14, 0.13] | -0.13 | 0.906
34+
Parameter | Coefficient | SE | 95% CI | t(144) | p
35+
-------------------------------------------------------------------
36+
x | 0.01 | 0.02 | [-0.02, 0.05] | 0.89 | 0.375
37+
Petal.Length | 0.23 | 0.05 | [ 0.13, 0.34] | 4.42 | < .001
38+
Sepal.Length | -4.24e-03 | 0.04 | [-0.09, 0.08] | -0.10 | 0.924
3939
4040
# Sepal.Width ~ x + Petal.Length + Sepal.Length
4141
42-
Parameter | Coefficient | SE | 95% CI | t(2) | p
43-
-----------------------------------------------------------------
44-
x | 0.03 | 0.04 | [-0.15, 0.22] | 0.81 | 0.502
45-
Petal.Length | -0.04 | 0.19 | [-0.85, 0.78] | -0.20 | 0.858
46-
Sepal.Length | 0.37 | 0.20 | [-0.49, 1.23] | 1.86 | 0.205
42+
Parameter | Coefficient | SE | 95% CI | t(144) | p
43+
-------------------------------------------------------------------
44+
x | 0.03 | 0.03 | [-0.02, 0.09] | 1.37 | 0.171
45+
Petal.Length | -0.04 | 0.08 | [-0.21, 0.13] | -0.45 | 0.651
46+
Sepal.Length | 0.37 | 0.07 | [ 0.23, 0.51] | 5.23 | < .001
4747
Message
4848
4949
Uncertainty intervals (equal-tailed) and p-values (two-tailed) computed
@@ -55,18 +55,18 @@
5555
print(ci(mod))
5656
Output
5757
Parameter CI CI_low CI_high Response
58-
1 x 0.95 -0.06044147 0.09280643 Petal.Width
59-
2 x 0.95 -0.06835071 0.09635073 Petal.Width
60-
3 Petal.Length 0.95 -0.06642354 0.52593096 Petal.Width
61-
4 x 0.95 -0.06835856 0.09655518 Petal.Width
62-
5 Petal.Length 0.95 -0.10895767 0.57612928 Petal.Width
63-
6 Sepal.Length 0.95 -0.14108092 0.13259825 Petal.Width
64-
7 x 0.95 -0.22113283 0.31370225 Sepal.Width
65-
8 x 0.95 -0.22124463 0.30818414 Sepal.Width
66-
9 Petal.Length 0.95 0.04898068 0.54369328 Sepal.Width
67-
10 x 0.95 -0.14997065 0.21974036 Sepal.Width
68-
11 Petal.Length 0.95 -0.85203579 0.77537142 Sepal.Width
69-
12 Sepal.Length 0.95 -0.48871075 1.22952907 Sepal.Width
58+
1 x 0.95 -0.01929491 0.05165987 Petal.Width
59+
2 x 0.95 -0.01715341 0.04515343 Petal.Width
60+
3 Petal.Length 0.95 0.16163902 0.29786840 Petal.Width
61+
4 x 0.95 -0.01722960 0.04542622 Petal.Width
62+
5 Petal.Length 0.95 0.12908917 0.33808245 Petal.Width
63+
6 Sepal.Length 0.95 -0.09172321 0.08324053 Petal.Width
64+
7 x 0.95 -0.01227870 0.10484812 Sepal.Width
65+
8 x 0.95 -0.01093910 0.09787861 Sepal.Width
66+
9 Petal.Length 0.95 0.17737594 0.41529802 Sepal.Width
67+
10 x 0.95 -0.01527889 0.08504860 Sepal.Width
68+
11 Petal.Length 0.95 -0.20565718 0.12899281 Sepal.Width
69+
12 Sepal.Length 0.95 0.23032902 0.51048930 Sepal.Width
7070
Group
7171
1 x
7272
2 x + Petal.Length
@@ -88,17 +88,17 @@
8888
Output
8989
# Petal.Width response
9090
91-
Parameter | Coefficient | SE | 95% CI | t(2) | p
92-
----------------------------------------------------------------
93-
x | 0.01 | 0.02 | [-0.07, 0.10] | 0.73 | 0.541
94-
Petal Length | 0.23 | 0.07 | [-0.07, 0.53] | 3.34 | 0.079
91+
Parameter | Coefficient | SE | 95% CI | t(145) | p
92+
-------------------------------------------------------------------
93+
x | 0.01 | 0.02 | [-0.02, 0.05] | 0.89 | 0.376
94+
Petal Length | 0.23 | 0.03 | [ 0.16, 0.30] | 6.67 | < .001
9595
9696
# Sepal.Width response
9797
98-
Parameter | Coefficient | SE | 95% CI | t(2) | p
99-
----------------------------------------------------------------
100-
x | 0.04 | 0.06 | [-0.22, 0.31] | 0.71 | 0.553
101-
Petal Length | 0.30 | 0.06 | [ 0.05, 0.54] | 5.15 | 0.036
98+
Parameter | Coefficient | SE | 95% CI | t(145) | p
99+
-------------------------------------------------------------------
100+
x | 0.04 | 0.03 | [-0.01, 0.10] | 1.58 | 0.116
101+
Petal Length | 0.30 | 0.06 | [ 0.18, 0.42] | 4.92 | < .001
102102
Message
103103
104104
Uncertainty intervals (equal-tailed) and p-values (two-tailed) computed
@@ -110,10 +110,10 @@
110110
print(ci(mod))
111111
Output
112112
Parameter CI CI_low CI_high Response
113-
1 x 0.95 -0.06835071 0.09635073 Petal.Width
114-
2 Petal.Length 0.95 -0.06642354 0.52593096 Petal.Width
115-
3 x 0.95 -0.22124463 0.30818414 Sepal.Width
116-
4 Petal.Length 0.95 0.04898068 0.54369328 Sepal.Width
113+
1 x 0.95 -0.01715341 0.04515343 Petal.Width
114+
2 Petal.Length 0.95 0.16163902 0.29786840 Petal.Width
115+
3 x 0.95 -0.01093910 0.09787861 Sepal.Width
116+
4 Petal.Length 0.95 0.17737594 0.41529802 Sepal.Width
117117

118118
---
119119

@@ -122,24 +122,24 @@
122122
Output
123123
# x
124124
125-
Parameter | Coefficient | SE | 95% CI | t(2) | p
126-
-------------------------------------------------------------
127-
x | 0.02 | 0.02 | [-0.06, 0.09] | 0.91 | 0.459
125+
Parameter | Coefficient | SE | 95% CI | t(146) | p
126+
---------------------------------------------------------------
127+
x | 0.02 | 0.02 | [-0.02, 0.05] | 0.90 | 0.369
128128
129129
# x + Petal.Length
130130
131-
Parameter | Coefficient | SE | 95% CI | t(2) | p
132-
----------------------------------------------------------------
133-
x | 0.01 | 0.02 | [-0.07, 0.10] | 0.73 | 0.541
134-
Petal.Length | 0.23 | 0.07 | [-0.07, 0.53] | 3.34 | 0.079
131+
Parameter | Coefficient | SE | 95% CI | t(145) | p
132+
-------------------------------------------------------------------
133+
x | 0.01 | 0.02 | [-0.02, 0.05] | 0.89 | 0.376
134+
Petal.Length | 0.23 | 0.03 | [ 0.16, 0.30] | 6.67 | < .001
135135
136136
# x + Petal.Length + Sepal.Length
137137
138-
Parameter | Coefficient | SE | 95% CI | t(2) | p
139-
-----------------------------------------------------------------
140-
x | 0.01 | 0.02 | [-0.07, 0.10] | 0.74 | 0.539
141-
Petal.Length | 0.23 | 0.08 | [-0.11, 0.58] | 2.93 | 0.099
142-
Sepal.Length | -4.24e-03 | 0.03 | [-0.14, 0.13] | -0.13 | 0.906
138+
Parameter | Coefficient | SE | 95% CI | t(144) | p
139+
-------------------------------------------------------------------
140+
x | 0.01 | 0.02 | [-0.02, 0.05] | 0.89 | 0.375
141+
Petal.Length | 0.23 | 0.05 | [ 0.13, 0.34] | 4.42 | < .001
142+
Sepal.Length | -4.24e-03 | 0.04 | [-0.09, 0.08] | -0.10 | 0.924
143143
Message
144144
145145
Uncertainty intervals (equal-tailed) and p-values (two-tailed) computed
@@ -151,10 +151,10 @@
151151
print(ci(mod))
152152
Output
153153
Parameter CI CI_low CI_high Group
154-
1 x 0.95 -0.06044147 0.09280643 x
155-
2 x 0.95 -0.06835071 0.09635073 x + Petal.Length
156-
3 Petal.Length 0.95 -0.06642354 0.52593096 x + Petal.Length
157-
4 x 0.95 -0.06835856 0.09655518 x + Petal.Length + Sepal.Length
158-
5 Petal.Length 0.95 -0.10895767 0.57612928 x + Petal.Length + Sepal.Length
159-
6 Sepal.Length 0.95 -0.14108092 0.13259825 x + Petal.Length + Sepal.Length
154+
1 x 0.95 -0.01929491 0.05165987 x
155+
2 x 0.95 -0.01715341 0.04515343 x + Petal.Length
156+
3 Petal.Length 0.95 0.16163902 0.29786840 x + Petal.Length
157+
4 x 0.95 -0.01722960 0.04542622 x + Petal.Length + Sepal.Length
158+
5 Petal.Length 0.95 0.12908917 0.33808245 x + Petal.Length + Sepal.Length
159+
6 Sepal.Length 0.95 -0.09172321 0.08324053 x + Petal.Length + Sepal.Length
160160

tests/testthat/test-model_parameters.efa_cfa.R

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ test_that("principal_components", {
2727
test_that("efa-cfa", {
2828
skip_if_not_installed("psych")
2929
skip_if_not_installed("lavaan")
30+
skip_on_cran()
3031

3132
efa <- psych::fa(attitude, nfactors = 3)
3233
params <- parameters::model_parameters(efa)

tests/testthat/test-model_parameters.fixest.R

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
test_that("model_parameters.fixest", {
1+
test_that("model_parameters.fixest-1", {
22
skip_on_cran()
33
skip_if_not_installed("fixest")
44
skip_if_not_installed("carData")
@@ -73,7 +73,7 @@ test_that("model_parameters.fixest", {
7373
})
7474

7575

76-
test_that("model_parameters.fixest", {
76+
test_that("model_parameters.fixest-2", {
7777
skip_on_cran()
7878
skip_if_not_installed("fixest")
7979
skip_if_not_installed("carData")
@@ -110,8 +110,12 @@ test_that("robust standard errors", {
110110
expect_true(all(p2$p != p3$p))
111111
expect_true(all(p1$p != p3$p))
112112

113-
expect_error(standard_error(mod, vcov = "HC3"))
114-
expect_error(parameters(mod, vcov = "HC3"))
113+
# HC3 works since fixest 0.13.0
114+
skip_if_not_installed("fixest", minimum_version = "0.13.0")
115+
se4 <- sqrt(diag(vcov(mod, vcov = "HC3")))
116+
expect_equal(standard_error(mod, vcov = "HC3")$SE, se4, ignore_attr = TRUE, tolerance = 1e-4)
117+
expect_equal(parameters(mod, vcov = "HC3")$SE, se4, ignore_attr = TRUE, tolerance = 1e-4)
118+
115119
expect_error(parameters(mod, vcov = "hetero"), NA)
116120
expect_error(parameters(mod, vcov = "iid"), NA)
117121
})

0 commit comments

Comments
 (0)