From 9ec6d4eec8a4c47c3fa1debfc32d1a1f52633a09 Mon Sep 17 00:00:00 2001 From: Daniel Date: Wed, 4 Sep 2024 07:21:04 +0200 Subject: [PATCH] Prepare CRAN release (#1009) * Prepare CRAN release * cran comments * docs * test * submitted --- CRAN-SUBMISSION | 6 +++--- DESCRIPTION | 2 +- R/p_significance.R | 7 ++++++- cran-comments.md | 2 +- man/p_significance.lm.Rd | 10 ++++++---- tests/testthat/_snaps/p_significance.md | 8 ++++---- tests/testthat/test-p_significance.R | 2 +- 7 files changed, 22 insertions(+), 15 deletions(-) diff --git a/CRAN-SUBMISSION b/CRAN-SUBMISSION index 2c408c2f4..521ab7ac2 100644 --- a/CRAN-SUBMISSION +++ b/CRAN-SUBMISSION @@ -1,3 +1,3 @@ -Version: 0.22.1 -Date: 2024-07-21 11:02:42 UTC -SHA: 109a438b12d4893ae5b2b86aa058923798a6045a +Version: 0.22.2 +Date: 2024-09-03 21:16:57 UTC +SHA: 367dcec5489ffa53d5b768af6cfaadf1afe69666 diff --git a/DESCRIPTION b/DESCRIPTION index 6006efdb4..40dff279a 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Type: Package Package: parameters Title: Processing of Model Parameters -Version: 0.22.1.99 +Version: 0.22.2 Authors@R: c(person(given = "Daniel", family = "Lüdecke", diff --git a/R/p_significance.R b/R/p_significance.R index 1b640cad1..f45784e9e 100644 --- a/R/p_significance.R +++ b/R/p_significance.R @@ -64,7 +64,7 @@ bayestestR::p_significance #' m <- lm(mpg ~ gear + wt + cyl + hp, data = mtcars) #' m2 <- brm(mpg ~ gear + wt + cyl + hp, data = mtcars) #' # probability of significance (ps) for frequentist model -#' p_significance(m, threshold = 0.6) # ROPE for mpg as outcome +#' p_significance(m) #' # similar to ps of Bayesian models #' p_significance(m2) #' # similar to ps of simulated draws / bootstrap samples @@ -102,6 +102,11 @@ p_significance.lm <- function(x, threshold = "default", ci = 0.95, verbose = TRU })) colnames(posterior) <- out$Parameter + # calculate the ROPE range + if (all(threshold == "default")) { + threshold <- bayestestR::rope_range(x, verbose = verbose) + } + out$ps <- as.numeric(bayestestR::p_significance( posterior, threshold = threshold, diff --git a/cran-comments.md b/cran-comments.md index 35e40b5f5..127ca3820 100644 --- a/cran-comments.md +++ b/cran-comments.md @@ -1 +1 @@ -Maintainance release. Furthermore, this release also fixes an issue with the _datawizard_ dependency on Mac OS X with R (old-release). +Maintainance release. diff --git a/man/p_significance.lm.Rd b/man/p_significance.lm.Rd index b193d8860..e7f1916b2 100644 --- a/man/p_significance.lm.Rd +++ b/man/p_significance.lm.Rd @@ -13,10 +13,12 @@ negligible effect, which can have following possible values: \itemize{ \item \code{"default"}, in which case the range is set to \code{0.1} if input is a vector, -and based on \code{\link[bayestestR:rope_range]{rope_range()}} if a Bayesian model is provided. +and based on \code{\link[bayestestR:rope_range]{rope_range()}} if a (Bayesian) model is provided. \item a single numeric value (e.g., 0.1), which is used as range around zero -(i.e. the threshold range is set to -0.1 and 0.1) -\item a numeric vector of length two (e.g., \code{c(-0.2, 0.1)}). +(i.e. the threshold range is set to -0.1 and 0.1, i.e. reflects a symmetric +interval) +\item a numeric vector of length two (e.g., \code{c(-0.2, 0.1)}), useful for +asymmetric intervals. }} \item{ci}{Confidence Interval (CI) level. Default to \code{0.95} (\verb{95\%}).} @@ -77,7 +79,7 @@ library(brms) m <- lm(mpg ~ gear + wt + cyl + hp, data = mtcars) m2 <- brm(mpg ~ gear + wt + cyl + hp, data = mtcars) # probability of significance (ps) for frequentist model -p_significance(m, threshold = 0.6) # ROPE for mpg as outcome +p_significance(m) # similar to ps of Bayesian models p_significance(m2) # similar to ps of simulated draws / bootstrap samples diff --git a/tests/testthat/_snaps/p_significance.md b/tests/testthat/_snaps/p_significance.md index 2a9fb2ae6..d23d18f77 100644 --- a/tests/testthat/_snaps/p_significance.md +++ b/tests/testthat/_snaps/p_significance.md @@ -3,13 +3,13 @@ Code print(x) Output - Practical Significance (threshold: -0.10, 0.10) + Practical Significance (threshold: -0.60, 0.60) Parameter | 95% CI | ps ----------------------------------------- (Intercept) | [24.44, 48.94] | ps > .999 - gear | [-1.69, 2.41] | ps = 0.600 - wt | [-4.77, -1.28] | ps > .999 - cyl | [-2.17, 0.55] | ps = 0.851 + gear | [-1.69, 2.41] | ps = 0.408 + wt | [-4.77, -1.28] | ps = 0.997 + cyl | [-2.17, 0.55] | ps = 0.620 hp | [-0.05, 0.01] | ps < .001 diff --git a/tests/testthat/test-p_significance.R b/tests/testthat/test-p_significance.R index d5965b38e..9d4846e50 100644 --- a/tests/testthat/test-p_significance.R +++ b/tests/testthat/test-p_significance.R @@ -12,7 +12,7 @@ test_that("p_significance", { set.seed(123) x <- p_significance(m, ci = 0.8) - expect_equal(x$ps, c(1, 0.6025, 0.9997, 0.8561, 0), tolerance = 1e-4) + expect_equal(x$ps, c(1, 0.4061, 0.9975, 0.6229, 0), tolerance = 1e-4) set.seed(123) x <- p_significance(m, threshold = 0.5)