Skip to content

Commit 1553b4f

Browse files
authored
Prepare CRAN submission (#1164)
* Prepare CRAN submission * fix typoe * styler * styler * Remove bayestestR issue reference Remove reference to bayestestR issue #736 from DESCRIPTION.
1 parent 61a1aeb commit 1553b4f

14 files changed

+89
-75
lines changed

DESCRIPTION

Lines changed: 5 additions & 6 deletions
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.0.16
4+
Version: 0.28.1
55
Authors@R:
66
c(person(given = "Daniel",
77
family = "Lüdecke",
@@ -78,9 +78,9 @@ BugReports: https://github.com/easystats/parameters/issues
7878
Depends:
7979
R (>= 3.6)
8080
Imports:
81-
bayestestR (>= 0.16.1),
81+
bayestestR (>= 0.17.0),
8282
datawizard (>= 1.2.0),
83-
insight (>= 1.4.0),
83+
insight (>= 1.4.1),
8484
graphics,
8585
methods,
8686
stats,
@@ -121,7 +121,7 @@ Suggests:
121121
domir (>= 0.2.0),
122122
drc,
123123
DRR,
124-
effectsize (>= 0.8.6),
124+
effectsize (>= 1.0.1),
125125
EGAnet,
126126
emmeans (>= 1.7.0),
127127
epiR,
@@ -158,7 +158,7 @@ Suggests:
158158
logspline,
159159
lqmm,
160160
M3C,
161-
marginaleffects (>= 0.26.0),
161+
marginaleffects (>= 0.29.0),
162162
modelbased (>= 0.9.0),
163163
MASS,
164164
Matrix,
@@ -231,4 +231,3 @@ Config/testthat/parallel: true
231231
Config/Needs/website: easystats/easystatstemplate
232232
Config/Needs/check: stan-dev/cmdstanr
233233
Config/rcmdcheck/ignore-inconsequential-notes: true
234-
Remotes: easystats/insight, easystats/bayestestR, easystats/modelbased, vincentarelbundock/marginaleffects

NEWS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# parameters (devel)
1+
# parameters 0.28.1
22

33
## Changes
44

R/methods_marginaleffects.R

Lines changed: 19 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,21 @@
44
# model_parameters ----------------
55

66
#' @export
7-
model_parameters.marginaleffects <- function(model,
8-
ci = 0.95,
9-
exponentiate = FALSE,
10-
verbose = TRUE,
11-
...) {
12-
insight::check_if_installed("marginaleffects", minimum_version = "0.28.0.22")
7+
model_parameters.marginaleffects <- function(
8+
model,
9+
ci = 0.95,
10+
exponentiate = FALSE,
11+
verbose = TRUE,
12+
...
13+
) {
14+
insight::check_if_installed("marginaleffects", minimum_version = "0.29.0")
1315

1416
# Bayesian models have posterior draws as attribute
1517
is_bayesian <- !is.null(suppressWarnings(marginaleffects::get_draws(model, "PxD")))
1618

1719
if (is_bayesian) {
1820
# Bayesian
19-
out <- suppressWarnings(bayestestR::describe_posterior(
20-
model,
21-
ci = ci,
22-
verbose = verbose,
23-
...
24-
))
21+
out <- suppressWarnings(bayestestR::describe_posterior(model, ci = ci, verbose = verbose, ...))
2522
} else {
2623
# non-Bayesian
2724
out <- as.data.frame(model)
@@ -105,24 +102,21 @@ model_parameters.slopes <- model_parameters.marginaleffects
105102

106103

107104
#' @export
108-
model_parameters.predictions <- function(model,
109-
ci = 0.95,
110-
exponentiate = FALSE,
111-
verbose = TRUE,
112-
...) {
113-
insight::check_if_installed("marginaleffects", minimum_version = "0.28.0.22")
105+
model_parameters.predictions <- function(
106+
model,
107+
ci = 0.95,
108+
exponentiate = FALSE,
109+
verbose = TRUE,
110+
...
111+
) {
112+
insight::check_if_installed("marginaleffects", minimum_version = "0.29.0")
114113

115114
# Bayesian models have posterior draws as attribute
116115
is_bayesian <- !is.null(suppressWarnings(marginaleffects::get_draws(model, "PxD")))
117116

118117
if (is_bayesian) {
119118
# Bayesian
120-
out <- suppressWarnings(bayestestR::describe_posterior(
121-
model,
122-
ci = ci,
123-
verbose = verbose,
124-
...
125-
))
119+
out <- suppressWarnings(bayestestR::describe_posterior(model, ci = ci, verbose = verbose, ...))
126120
} else {
127121
# columns we want to keep
128122
by_cols <- .keep_me_columns(model)
@@ -151,11 +145,7 @@ model_parameters.predictions <- function(model,
151145
# find cofficient name - differs for Bayesian models
152146
coef_name <- intersect(c("Predicted", "Coefficient"), colnames(out))[1]
153147
if (!is.null(at_variables) && !is.na(coef_name) && all(at_variables %in% colnames(out))) {
154-
out <- datawizard::data_relocate(
155-
out,
156-
select = at_variables,
157-
after = coef_name
158-
)
148+
out <- datawizard::data_relocate(out, select = at_variables, after = coef_name)
159149
}
160150

161151
# extract response, remove from data frame

R/standardize_info.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
#'
1818
#' @family standardize
1919
#'
20-
#' @examplesIf insight::check_if_installed("datawizard", minimum_version = "0.12.0", quietly = TRUE)
20+
#' @examplesIf insight::check_if_installed("datawizard", quietly = TRUE)
2121
#' model <- lm(mpg ~ ., data = mtcars)
2222
#' standardize_info(model)
2323
#' standardize_info(model, robust = TRUE)
@@ -411,7 +411,7 @@ standardize_info.default <- function(model,
411411
}
412412

413413
insight::check_if_installed("performance")
414-
insight::check_if_installed("datawizard", minimum_version = "0.12.0")
414+
insight::check_if_installed("datawizard")
415415

416416
f <- if (two_sd) 2 else 1
417417

man/standardize_info.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/testthat/test-marginaleffects.R

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
skip_if_not_installed("marginaleffects", minimum_version = "0.28.0.22")
1+
skip_if_not_installed("marginaleffects", minimum_version = "0.29.0")
22
skip_if_not_installed("rstanarm")
33

44
test_that("marginaleffects()", {
@@ -201,7 +201,7 @@ test_that("predictions, bmrs with special response formula", {
201201
skip_if_offline()
202202
skip_if_not_installed("httr2")
203203
skip_if_not_installed("brms")
204-
skip_if_not_installed("marginaleffects", minimum_version = "0.28.0.22")
204+
skip_if_not_installed("marginaleffects", minimum_version = "0.29.0")
205205

206206
m <- insight::download_model("brms_ipw_1")
207207
skip_if(is.null(m))
@@ -213,7 +213,7 @@ test_that("predictions, bmrs with special response formula", {
213213

214214

215215
test_that("modelbased, tidiers work", {
216-
skip_if_not_installed("marginaleffects", minimum_version = "0.28.0.22")
216+
skip_if_not_installed("marginaleffects", minimum_version = "0.29.0")
217217
skip_if_not_installed("modelbased", minimum_version = "0.12.0.17")
218218
skip_if(getRversion() < "4.5.0")
219219

@@ -285,7 +285,7 @@ test_that("predictions, using bayestestR #1063", {
285285
skip_if_offline()
286286
skip_if_not_installed("httr2")
287287
skip_if_not_installed("brms")
288-
skip_if_not_installed("marginaleffects", minimum_version = "0.28.0.22")
288+
skip_if_not_installed("marginaleffects", minimum_version = "0.29.0")
289289

290290
m <- insight::download_model("brms_mixed_3")
291291
skip_if(is.null(m))

tests/testthat/test-model_parameters.anova.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ test_that("model_parameters_Anova.mlm-2", {
9595

9696
test_that("model_parameters_Anova-effectsize", {
9797
skip_if_not_installed("lme4")
98-
skip_if_not_installed("effectsize", minimum_version = "0.4.3")
98+
skip_if_not_installed("effectsize")
9999

100100
df <- iris
101101
df$Sepal.Big <- ifelse(df$Sepal.Width >= 3, "Yes", "No")

tests/testthat/test-model_parameters.aov.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@ iris$Cat2 <- rep_len(c("A", "B"), nrow(iris))
66
# aov ----------------------------------
77

88
test_that("model_parameters.aov", {
9-
skip_if_not_installed("effectsize", minimum_version = "0.5.0")
9+
skip_if_not_installed("effectsize")
1010
model <- aov(Sepal.Width ~ Species, data = iris)
1111
mp <- suppressMessages(model_parameters(model, es_type = c("omega", "eta", "epsilon")))
1212
expect_identical(mp$Parameter, c("Species", "Residuals"))
1313
expect_equal(mp$Sum_Squares, c(11.34493, 16.962), tolerance = 1e-3)
1414
})
1515

1616
test_that("model_parameters.aov", {
17-
skip_if_not_installed("effectsize", minimum_version = "0.5.0")
17+
skip_if_not_installed("effectsize")
1818
model <- aov(Sepal.Width ~ Species, data = iris)
1919
mp <- suppressMessages(model_parameters(model, es_type = c("omega", "eta", "epsilon")))
2020
expect_identical(sum(mp$df), 149)

tests/testthat/test-model_parameters.aov_es_ci.R

Lines changed: 49 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ iris$Cat2 <- rep_len(c("A", "B"), nrow(iris))
44
# aov ----------------------------------
55

66
test_that("model_parameters.aov", {
7-
skip_if_not_installed("effectsize", minimum_version = "0.5.1")
7+
skip_if_not_installed("effectsize")
88

99
model <- aov(Sepal.Width ~ Species, data = iris)
1010
mp <- suppressMessages(model_parameters(
@@ -20,26 +20,52 @@ test_that("model_parameters.aov", {
2020
expect_equal(na.omit(mp$Omega2_CI_high), es$CI_high, tolerance = 1e-3, ignore_attr = TRUE)
2121
expect_equal(na.omit(mp$Omega2_CI_high), 1, tolerance = 1e-3, ignore_attr = TRUE)
2222

23-
expect_identical(colnames(mp), c(
24-
"Parameter", "Sum_Squares", "df", "Mean_Square", "F", "p",
25-
"Omega2", "Omega2_CI_low", "Omega2_CI_high", "Eta2",
26-
"Eta2_CI_low", "Eta2_CI_high", "Epsilon2", "Epsilon2_CI_low",
27-
"Epsilon2_CI_high"
28-
))
23+
expect_identical(
24+
colnames(mp),
25+
c(
26+
"Parameter",
27+
"Sum_Squares",
28+
"df",
29+
"Mean_Square",
30+
"F",
31+
"p",
32+
"Omega2",
33+
"Omega2_CI_low",
34+
"Omega2_CI_high",
35+
"Eta2",
36+
"Eta2_CI_low",
37+
"Eta2_CI_high",
38+
"Epsilon2",
39+
"Epsilon2_CI_low",
40+
"Epsilon2_CI_high"
41+
)
42+
)
2943

3044
model <- aov(Sepal.Length ~ Species * Cat1 * Cat2, data = iris)
3145
mp <- model_parameters(model, es_type = "eta", ci = 0.9, partial = FALSE, alternative = "greater")
3246
es <- effectsize::eta_squared(model, partial = FALSE, ci = 0.9)
3347
expect_equal(na.omit(mp$Eta2_CI_low), es$CI_low, tolerance = 1e-3, ignore_attr = TRUE)
34-
expect_equal(mp$Eta2_CI_low, c(0.5572, 0, 0, 0, 0, 0, 0, NA), tolerance = 1e-3, ignore_attr = TRUE)
48+
expect_equal(
49+
mp$Eta2_CI_low,
50+
c(0.5572, 0, 0, 0, 0, 0, 0, NA),
51+
tolerance = 1e-3,
52+
ignore_attr = TRUE
53+
)
3554
expect_equal(na.omit(mp$Eta2_CI_high), es$CI_high, tolerance = 1e-3, ignore_attr = TRUE)
3655
expect_equal(na.omit(mp$Eta2_CI_high), rep(1, 7), tolerance = 1e-3, ignore_attr = TRUE)
3756

3857
expect_identical(
3958
colnames(mp),
4059
c(
41-
"Parameter", "Sum_Squares", "df", "Mean_Square", "F", "p",
42-
"Eta2", "Eta2_CI_low", "Eta2_CI_high"
60+
"Parameter",
61+
"Sum_Squares",
62+
"df",
63+
"Mean_Square",
64+
"F",
65+
"p",
66+
"Eta2",
67+
"Eta2_CI_low",
68+
"Eta2_CI_high"
4369
)
4470
)
4571
})
@@ -48,7 +74,7 @@ test_that("model_parameters.aov", {
4874
# anova ---------------------
4975

5076
test_that("model_parameters.anova", {
51-
skip_if_not_installed("effectsize", minimum_version = "0.5.1")
77+
skip_if_not_installed("effectsize")
5278

5379
model <- anova(lm(Sepal.Length ~ Species * Cat1 * Cat2, data = iris))
5480
mp <- model_parameters(
@@ -72,7 +98,7 @@ test_that("model_parameters.anova", {
7298
})
7399

74100
test_that("model_parameters.anova", {
75-
skip_if_not_installed("effectsize", minimum_version = "0.5.1")
101+
skip_if_not_installed("effectsize")
76102
model <- aov(wt ~ cyl + Error(gear), data = mtcars)
77103
suppressWarnings({
78104
mp <- model_parameters(model, es_type = c("omega", "eta", "epsilon"), partial = TRUE, ci = 0.9)
@@ -96,16 +122,15 @@ test_that("model_parameters.anova", {
96122
test_that("model_parameters.car-anova", {
97123
skip_if_not_installed("car")
98124
skip_if_not_installed("carData")
99-
skip_if_not_installed("effectsize", minimum_version = "0.5.1")
125+
skip_if_not_installed("effectsize")
100126

101127
data(Moore, package = "carData")
102128
set.seed(123)
103-
model <-
104-
car::Anova(stats::lm(
105-
formula = conformity ~ fcategory * partner.status,
106-
data = Moore,
107-
contrasts = list(fcategory = contr.sum, partner.status = contr.sum)
108-
))
129+
model <- car::Anova(stats::lm(
130+
formula = conformity ~ fcategory * partner.status,
131+
data = Moore,
132+
contrasts = list(fcategory = contr.sum, partner.status = contr.sum)
133+
))
109134

110135
mp <- model_parameters(model, es_type = c("omega", "eta", "epsilon"), partial = TRUE, ci = 0.9)
111136
es <- effectsize::omega_squared(model, partial = TRUE, ci = 0.9)
@@ -125,7 +150,7 @@ test_that("model_parameters.car-anova", {
125150

126151
# maov ----------------------------------
127152
test_that("model_parameters.maov", {
128-
skip_if_not_installed("effectsize", minimum_version = "0.5.1")
153+
skip_if_not_installed("effectsize")
129154

130155
set.seed(123)
131156
fit <- lm(cbind(mpg, disp, hp) ~ factor(cyl), data = mtcars)
@@ -156,7 +181,7 @@ test_that("model_parameters.maov", {
156181

157182
test_that("works with aov", {
158183
skip_on_cran()
159-
skip_if_not_installed("effectsize", minimum_version = "0.5.1")
184+
skip_if_not_installed("effectsize")
160185

161186
set.seed(123)
162187
npk.aov <- aov(yield ~ block + N * P, npk)
@@ -267,7 +292,7 @@ test_that("works with aov", {
267292

268293
test_that("works with manova", {
269294
skip_on_cran()
270-
skip_if_not_installed("effectsize", minimum_version = "0.5.1")
295+
skip_if_not_installed("effectsize")
271296

272297
set.seed(123)
273298
# fake a 2nd response variable
@@ -318,7 +343,7 @@ test_that("works with manova", {
318343
test_that("works with Gam", {
319344
skip_on_cran()
320345
skip_if_not_installed("gam")
321-
skip_if_not_installed("effectsize", minimum_version = "0.5.1")
346+
skip_if_not_installed("effectsize")
322347

323348
# setup
324349
set.seed(123)
@@ -371,7 +396,7 @@ test_that("works with Gam", {
371396
test_that("works with anova", {
372397
skip_on_cran()
373398
skip_if_not_installed("car")
374-
skip_if_not_installed("effectsize", minimum_version = "0.7.1")
399+
skip_if_not_installed("effectsize")
375400

376401
set.seed(123)
377402
mod <-

tests/testthat/test-p_significance.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
skip_on_cran()
2-
skip_if_not_installed("bayestestR", minimum_version = "0.15.0")
2+
skip_if_not_installed("bayestestR")
33
skip_if_not_installed("distributional")
44
skip_if_not_installed("withr")
55

0 commit comments

Comments
 (0)