From f222a45df602d39939f1180be97a482e24c86e5c Mon Sep 17 00:00:00 2001 From: Indrajeet Patil Date: Tue, 19 Jan 2021 15:07:42 +0100 Subject: [PATCH] cran resubmission 0.7 --- API | 2 +- CRAN-RELEASE | 4 +- R/bf_expr_template.R | 95 ----------- R/contingency_tabs.R | 4 +- R/corr_test.R | 2 +- R/global_vars.R | 1 - R/helpers_bf_tests.R | 5 +- ...pr_template.R => helpers_expr_templates.R} | 155 ++++++++++++++---- R/meta_random.R | 2 +- R/oneway_anova.R | 2 +- R/t_onesample.R | 4 +- R/t_twosample.R | 2 +- codemeta.json | 2 +- cran-comments.md | 1 + docs/pkgdown.yml | 2 +- docs/reference/bf_expr_template.html | 6 +- docs/reference/expr_contingency_tab.html | 12 +- docs/reference/expr_corr_test.html | 10 +- docs/reference/expr_meta_random.html | 10 +- docs/reference/expr_oneway_anova.html | 18 +- docs/reference/expr_t_onesample.html | 15 +- docs/reference/expr_t_twosample.html | 18 +- docs/reference/expr_template.html | 14 +- docs/reference/index.html | 15 +- man/bf_expr_template.Rd | 6 +- man/expr_contingency_tab.Rd | 6 +- man/expr_corr_test.Rd | 4 +- man/expr_meta_random.Rd | 4 +- man/expr_oneway_anova.Rd | 12 +- man/expr_t_onesample.Rd | 6 +- man/expr_t_twosample.Rd | 12 +- man/expr_template.Rd | 8 +- tests/spelling.R | 9 +- tests/testthat/test-expr_templates.R | 9 + 34 files changed, 231 insertions(+), 246 deletions(-) delete mode 100644 R/bf_expr_template.R rename R/{expr_template.R => helpers_expr_templates.R} (68%) diff --git a/API b/API index e4fcfc24..6a0f3b75 100644 --- a/API +++ b/API @@ -2,7 +2,7 @@ ## Exported functions -bf_expr_template(top.text, estimate.df, prior.type = NULL, estimate.type = NULL, centrality = "median", conf.level = 0.95, conf.method = "HDI", k = 2L, ...) +bf_expr_template(top.text, stats.df, prior.type = NULL, estimate.type = NULL, centrality = "median", conf.level = 0.95, conf.method = "HDI", k = 2L, ...) bf_extractor(bf.object, conf.level = 0.95, centrality = "median", conf.method = "hdi", k = 2L, top.text = NULL, output = "dataframe", ...) expr_contingency_tab(data, x, y = NULL, paired = FALSE, type = "parametric", counts = NULL, ratio = NULL, k = 2L, conf.level = 0.95, sampling.plan = "indepMulti", fixed.margin = "rows", prior.concentration = 1, top.text = NULL, output = "expression", ...) expr_corr_test(data, x, y, type = "parametric", k = 2L, conf.level = 0.95, beta = 0.1, bf.prior = 0.707, top.text = NULL, output = "expression", ...) diff --git a/CRAN-RELEASE b/CRAN-RELEASE index 213ee43e..60b1734b 100644 --- a/CRAN-RELEASE +++ b/CRAN-RELEASE @@ -1,2 +1,2 @@ -This package was submitted to CRAN on 2021-01-18. -Once it is accepted, delete this file and tag the release (commit 9e212f9). +This package was submitted to CRAN on 2021-01-19. +Once it is accepted, delete this file and tag the release (commit d6a731d). diff --git a/R/bf_expr_template.R b/R/bf_expr_template.R deleted file mode 100644 index 58dfe67f..00000000 --- a/R/bf_expr_template.R +++ /dev/null @@ -1,95 +0,0 @@ -#' @title Expression template for Bayes Factor results -#' @name bf_expr_template -#' -#' @param prior.type A character that specifies the prior type. -#' @param estimate.type A character that specifies the relevant effect size. -#' @param estimate.df Dataframe containing estimates and their credible -#' intervals along with Bayes Factor value. The columns should be named as -#' `estimate`, `estimate.LB`, `estimate.UB`, and `bf10`. -#' @param ... Currently ignored. -#' @inheritParams bf_extractor -#' @inheritParams expr_t_twosample -#' -#' @importFrom ipmisc format_num -#' -#' @export - -bf_expr_template <- function(top.text, - estimate.df, - prior.type = NULL, - estimate.type = NULL, - centrality = "median", - conf.level = 0.95, - conf.method = "HDI", - k = 2L, - ...) { - # extracting estimate values - if ("r2" %in% names(estimate.df)) { - # for ANOVA designs - c(estimate, estimate.LB, estimate.UB) %<-% - c(estimate.df$r2[[1]], estimate.df$r2.conf.low[[1]], estimate.df$r2.conf.high[[1]]) - } else { - # for non-ANOVA designs - c(estimate, estimate.LB, estimate.UB) %<-% - c(estimate.df$estimate[[1]], estimate.df$conf.low[[1]], estimate.df$conf.high[[1]]) - } - - # if expression elements are `NULL` - if (is.null(prior.type)) prior.type <- prior_type_switch(estimate.df$method[[1]]) - if (is.null(estimate.type)) estimate.type <- estimate_type_switch(estimate.df$method[[1]]) - - # prepare the Bayes Factor message - bf01_expr <- - substitute( - atop( - displaystyle(top.text), - expr = paste( - "log"["e"] * "(BF"["01"] * ") = " * bf * ", ", - widehat(estimate.type)[centrality]^"posterior" * " = " * estimate * ", ", - "CI"[conf.level]^conf.method * " [" * estimate.LB * ", " * estimate.UB * "], ", - prior.type * " = " * bf.prior - ) - ), - env = list( - top.text = top.text, - estimate.type = estimate.type, - centrality = centrality, - conf.level = paste0(conf.level * 100, "%"), - conf.method = toupper(conf.method), - bf = format_num(-log(estimate.df$bf10[[1]]), k = k), - estimate = format_num(estimate, k = k), - estimate.LB = format_num(estimate.LB, k = k), - estimate.UB = format_num(estimate.UB, k = k), - prior.type = prior.type, - bf.prior = format_num(estimate.df$prior.scale[[1]], k = k) - ) - ) - - # return the final expression - if (is.null(top.text)) bf01_expr$expr else bf01_expr -} - - -#' @noRd - -prior_type_switch <- function(method) { - switch( - method, - "Bayesian contingency tabs analysis" = quote(italic("a")["Gunel-Dickey"]), - quote(italic("r")["Cauchy"]^"JZS") - ) -} - - -#' @noRd - -estimate_type_switch <- function(method) { - switch( - method, - "Bayesian contingency tabs analysis" = quote(italic("V")), - "Bayesian correlation analysis" = quote(italic(rho)), - "Bayesian meta-analysis using 'metaBMA'" = , - "Bayesian t-test" = quote(italic(delta)), - "Bayes factors for linear models" = quote(italic(R^"2")) - ) -} diff --git a/R/contingency_tabs.R b/R/contingency_tabs.R index c672d701..58e27614 100644 --- a/R/contingency_tabs.R +++ b/R/contingency_tabs.R @@ -1,7 +1,7 @@ +#' @title Expression and dataframe for contingency table analysis #' @name expr_contingency_tab -#' @title Making expression for contingency table analysis #' -#' @return Expression or a dataframe for contingency analysis (Pearson's +#' @return Expression or a dataframe for contingency table analysis (Pearson's #' chi-square test for independence for between-subjects design or McNemar's #' test for within-subjects design) or goodness of fit test for a single #' categorical variable. diff --git a/R/corr_test.R b/R/corr_test.R index 78156b11..ad1c7a7e 100644 --- a/R/corr_test.R +++ b/R/corr_test.R @@ -1,4 +1,4 @@ -#' @title Making expression for correlation analysis +#' @title Expression and dataframe for correlation analysis #' @name expr_corr_test #' #' @return Expression containing results from correlation test with confidence diff --git a/R/global_vars.R b/R/global_vars.R index 6806d8dc..868874a9 100644 --- a/R/global_vars.R +++ b/R/global_vars.R @@ -9,7 +9,6 @@ utils::globalVariables( "effsize", "effectsize", "estimate", - "int_df", "rowid", "statistic", "std.error", diff --git a/R/helpers_bf_tests.R b/R/helpers_bf_tests.R index 1407bb82..9d150849 100644 --- a/R/helpers_bf_tests.R +++ b/R/helpers_bf_tests.R @@ -90,9 +90,6 @@ bf_extractor <- function(bf.object, # combine everything df %<>% dplyr::bind_cols(., df_r2) - - # for expression - c(centrality, conf.method) %<-% c("median", "hdi") } # ------------------------ contingency tabs ------------------------------ @@ -106,7 +103,7 @@ bf_extractor <- function(bf.object, bf_expr_01 <- bf_expr_template( top.text = top.text, - estimate.df = df, + stats.df = df, centrality = centrality, conf.level = conf.level, conf.method = conf.method, diff --git a/R/expr_template.R b/R/helpers_expr_templates.R similarity index 68% rename from R/expr_template.R rename to R/helpers_expr_templates.R index a69413e4..bc89fdbf 100644 --- a/R/expr_template.R +++ b/R/helpers_expr_templates.R @@ -1,4 +1,4 @@ -#' @title Template for subtitles with statistical details for tests +#' @title Template for expressions with statistical details #' @name expr_template #' #' @param no.parameters An integer that specifies that the number of parameters @@ -59,7 +59,7 @@ #' conf.high = -1.088 #' ) #' -#' # subtitle for *t*-statistic with Cohen's *d* as effect size +#' # expression for *t*-statistic with Cohen's *d* as effect size #' statsExpressions::expr_template( #' no.parameters = 1L, #' stats.df = stats_df, @@ -90,13 +90,13 @@ expr_template <- function(no.parameters, if (isTRUE(paired) && is.null(n.text)) n.text <- quote(italic("n")["pairs"]) if (isFALSE(paired) && is.null(n.text)) n.text <- quote(italic("n")["obs"]) if (is.null(statistic.text)) statistic.text <- stat_text_switch(stats.df$method[[1]]) - if (is.null(effsize.text)) effsize.text <- effectsize_switch(stats.df$effectsize[[1]]) + if (is.null(effsize.text)) effsize.text <- estimate_type_switch(stats.df$effectsize[[1]]) # ------------------ statistic with 0 degrees of freedom -------------------- if (no.parameters == 0L) { - # preparing subtitle - subtitle <- + # preparing expression + expression <- substitute( expr = paste( statistic.text, @@ -109,12 +109,12 @@ expr_template <- function(no.parameters, ", ", effsize.text, " = ", - effsize.estimate, + estimate, ", CI"[conf.level], " [", - effsize.LL, + estimate.LB, ", ", - effsize.UL, + estimate.UB, "]", ", ", n.text, @@ -126,10 +126,10 @@ expr_template <- function(no.parameters, statistic = format_num(stats.df$statistic[[1]], k), p.value = format_num(stats.df$p.value[[1]], k = k, p.value = TRUE), effsize.text = effsize.text, - effsize.estimate = format_num(stats.df$estimate[[1]], k), + estimate = format_num(stats.df$estimate[[1]], k), conf.level = paste0(conf.level * 100, "%"), - effsize.LL = format_num(stats.df$conf.low[[1]], k), - effsize.UL = format_num(stats.df$conf.high[[1]], k), + estimate.LB = format_num(stats.df$conf.low[[1]], k), + estimate.UB = format_num(stats.df$conf.high[[1]], k), n = .prettyNum(n), n.text = n.text ) @@ -142,8 +142,8 @@ expr_template <- function(no.parameters, if ("df" %in% names(stats.df)) stats.df %<>% dplyr::rename("parameter" = "df") if ("df.error" %in% names(stats.df)) stats.df %<>% dplyr::rename("parameter" = "df.error") - # preparing subtitle - subtitle <- + # preparing expression + expression <- substitute( expr = paste( statistic.text, @@ -158,12 +158,12 @@ expr_template <- function(no.parameters, ", ", effsize.text, " = ", - effsize.estimate, + estimate, ", CI"[conf.level], " [", - effsize.LL, + estimate.LB, ", ", - effsize.UL, + estimate.UB, "]", ", ", n.text, @@ -176,10 +176,10 @@ expr_template <- function(no.parameters, parameter = format_num(stats.df$parameter[[1]], k = k.parameter), p.value = format_num(stats.df$p.value[[1]], k = k, p.value = TRUE), effsize.text = effsize.text, - effsize.estimate = format_num(stats.df$estimate[[1]], k), + estimate = format_num(stats.df$estimate[[1]], k), conf.level = paste0(conf.level * 100, "%"), - effsize.LL = format_num(stats.df$conf.low[[1]], k), - effsize.UL = format_num(stats.df$conf.high[[1]], k), + estimate.LB = format_num(stats.df$conf.low[[1]], k), + estimate.UB = format_num(stats.df$conf.high[[1]], k), n = .prettyNum(n), n.text = n.text ) @@ -190,11 +190,10 @@ expr_template <- function(no.parameters, if (no.parameters == 2L) { # renaming pattern from `easystats` - stats.df %<>% - dplyr::rename_all(.funs = dplyr::recode, df = "parameter1", df.error = "parameter2") + stats.df %<>% dplyr::rename_all(.funs = dplyr::recode, df = "parameter1", df.error = "parameter2") - # preparing subtitle - subtitle <- + # preparing expression + expression <- substitute( expr = paste( statistic.text, @@ -211,12 +210,12 @@ expr_template <- function(no.parameters, ", ", effsize.text, " = ", - effsize.estimate, + estimate, ", CI"[conf.level], " [", - effsize.LL, + estimate.LB, ", ", - effsize.UL, + estimate.UB, "]", ", ", n.text, @@ -230,20 +229,92 @@ expr_template <- function(no.parameters, parameter2 = format_num(stats.df$parameter2[[1]], k = k.parameter2), p.value = format_num(stats.df$p.value[[1]], k = k, p.value = TRUE), effsize.text = effsize.text, - effsize.estimate = format_num(stats.df$estimate[[1]], k), + estimate = format_num(stats.df$estimate[[1]], k), conf.level = paste0(conf.level * 100, "%"), - effsize.LL = format_num(stats.df$conf.low[[1]], k), - effsize.UL = format_num(stats.df$conf.high[[1]], k), + estimate.LB = format_num(stats.df$conf.low[[1]], k), + estimate.UB = format_num(stats.df$conf.high[[1]], k), n = .prettyNum(n), n.text = n.text ) ) } - # return the formatted subtitle - return(subtitle) + # return the formatted expression + expression } +#' @title Expression template for Bayes Factor results +#' @name bf_expr_template +#' +#' @param prior.type A character that specifies the prior type. +#' @param estimate.type A character that specifies the relevant effect size. +#' @param stats.df Dataframe containing estimates and their credible +#' intervals along with Bayes Factor value. The columns should be named as +#' `estimate`, `estimate.LB`, `estimate.UB`, and `bf10`. +#' @param ... Currently ignored. +#' @inheritParams bf_extractor +#' @inheritParams expr_t_twosample +#' +#' @importFrom ipmisc format_num +#' +#' @export + +bf_expr_template <- function(top.text, + stats.df, + prior.type = NULL, + estimate.type = NULL, + centrality = "median", + conf.level = 0.95, + conf.method = "HDI", + k = 2L, + ...) { + # extracting estimate values + if ("r2" %in% names(stats.df)) { + # for ANOVA designs + c(estimate, estimate.LB, estimate.UB) %<-% + c(stats.df$r2[[1]], stats.df$r2.conf.low[[1]], stats.df$r2.conf.high[[1]]) + } else { + # for non-ANOVA designs + c(estimate, estimate.LB, estimate.UB) %<-% + c(stats.df$estimate[[1]], stats.df$conf.low[[1]], stats.df$conf.high[[1]]) + } + + # if expression elements are `NULL` + if (is.null(prior.type)) prior.type <- prior_type_switch(stats.df$method[[1]]) + if (is.null(estimate.type)) estimate.type <- estimate_type_switch(stats.df$method[[1]]) + + # prepare the Bayes Factor message + expression <- + substitute( + atop( + displaystyle(top.text), + expr = paste( + "log"["e"] * "(BF"["01"] * ") = " * bf * ", ", + widehat(estimate.type)[centrality]^"posterior" * " = " * estimate * ", ", + "CI"[conf.level]^conf.method * " [" * estimate.LB * ", " * estimate.UB * "], ", + prior.type * " = " * bf.prior + ) + ), + env = list( + top.text = top.text, + estimate.type = estimate.type, + centrality = centrality, + conf.level = paste0(conf.level * 100, "%"), + conf.method = toupper(conf.method), + bf = format_num(-log(stats.df$bf10[[1]]), k = k), + estimate = format_num(estimate, k = k), + estimate.LB = format_num(estimate.LB, k = k), + estimate.UB = format_num(estimate.UB, k = k), + prior.type = prior.type, + bf.prior = format_num(stats.df$prior.scale[[1]], k = k) + ) + ) + + # return the final expression + if (is.null(top.text)) expression$expr else expression +} + + #' @noRd stat_text_switch <- function(method) { @@ -279,9 +350,9 @@ stat_text_switch <- function(method) { #' @noRd -effectsize_switch <- function(type) { +estimate_type_switch <- function(method) { switch( - type, + method, "Pearson" = quote(widehat(italic("r"))["Pearson"]), "Spearman" = quote(widehat(rho)["Spearman"]), "Percentage Bend" = quote(widehat(rho)["% bend"]), @@ -300,7 +371,23 @@ effectsize_switch <- function(type) { "Epsilon2 (rank)" = quote(widehat(epsilon)["ordinal"]^2), "Cramer's V (adj.)" = quote(widehat(italic("V"))["Cramer"]), "Cohen's g" = quote(widehat(italic("g"))["Cohen"]), - "meta-analytic summary estimate" = quote(widehat(beta)["summary"]^"meta") + "meta-analytic summary estimate" = quote(widehat(beta)["summary"]^"meta"), + "Bayesian contingency tabs analysis" = quote(italic("V")), + "Bayesian correlation analysis" = quote(italic(rho)), + "Bayesian meta-analysis using 'metaBMA'" = , + "Bayesian t-test" = quote(italic(delta)), + "Bayes factors for linear models" = quote(italic(R^"2")), + NULL + ) +} + +#' @noRd + +prior_type_switch <- function(method) { + switch( + method, + "Bayesian contingency tabs analysis" = quote(italic("a")["Gunel-Dickey"]), + quote(italic("r")["Cauchy"]^"JZS") ) } diff --git a/R/meta_random.R b/R/meta_random.R index 42eb0b5b..a2081f0f 100644 --- a/R/meta_random.R +++ b/R/meta_random.R @@ -1,4 +1,4 @@ -#' @title Making expression for random-effects meta-analysis +#' @title Expression and dataframe for random-effects meta-analysis #' @name expr_meta_random #' #' @param data A dataframe. It **must** contain columns named `estimate` (effect diff --git a/R/oneway_anova.R b/R/oneway_anova.R index dce182c9..ccec4307 100644 --- a/R/oneway_anova.R +++ b/R/oneway_anova.R @@ -1,4 +1,4 @@ -#' @title Expression containing ANOVA results +#' @title Expression and dataframe for one-way ANOVA #' @name expr_oneway_anova #' #' @return For more details, see- diff --git a/R/t_onesample.R b/R/t_onesample.R index ccfa5f6b..5e384875 100644 --- a/R/t_onesample.R +++ b/R/t_onesample.R @@ -1,5 +1,4 @@ -#' @title Expression for one sample *t*-test and its non-parametric and -#' robust equivalents +#' @title Expression and dataframe for one-sample *t*-test #' @name expr_t_onesample #' #' @param x A numeric variable from the dataframe `data`. @@ -7,6 +6,7 @@ #' (Default: `0`). #' @inheritParams ipmisc::long_to_wide_converter #' @inheritParams expr_template +#' @inheritParams bf_extractor #' @inheritParams expr_t_twosample #' @inheritParams expr_oneway_anova #' diff --git a/R/t_twosample.R b/R/t_twosample.R index af908ea0..bf2ab1bc 100644 --- a/R/t_twosample.R +++ b/R/t_twosample.R @@ -1,4 +1,4 @@ -#' @title Making expression containing *t*-test results +#' @title Expression and dataframe for two-sample *t*-test #' @name expr_t_twosample #' #' @inheritParams ipmisc::long_to_wide_converter diff --git a/codemeta.json b/codemeta.json index d36044a9..d659f3ae 100644 --- a/codemeta.json +++ b/codemeta.json @@ -387,6 +387,6 @@ "name": "Comprehensive R Archive Network (CRAN)", "url": "https://cran.r-project.org" }, - "fileSize": "3916.064KB", + "fileSize": "3915.557KB", "readme": "https://github.com/IndrajeetPatil/statsExpressions/blob/master/README.md" } diff --git a/cran-comments.md b/cran-comments.md index 45e3bc1e..feb21a13 100644 --- a/cran-comments.md +++ b/cran-comments.md @@ -8,6 +8,7 @@ 0 errors | 0 warnings | 0 note - Fixes failing CRAN tests due to `effectsize` and `metaBMA` package updates. + - All `donttest` examples have been checked on CI platforms. ## Reverse dependencies check diff --git a/docs/pkgdown.yml b/docs/pkgdown.yml index 229f5bf5..899d73eb 100644 --- a/docs/pkgdown.yml +++ b/docs/pkgdown.yml @@ -4,7 +4,7 @@ pkgdown_sha: e5847476d79f08b4cdca0ed5cc55bf55fc18a161 articles: stats_details: stats_details.html web_only/dataframe_outputs: dataframe_outputs.html -last_built: 2021-01-19T10:24Z +last_built: 2021-01-19T13:46Z urls: reference: https://indrajeetpatil.github.io/statsExpressions//reference article: https://indrajeetpatil.github.io/statsExpressions//articles diff --git a/docs/reference/bf_expr_template.html b/docs/reference/bf_expr_template.html index 10194d54..6ecd0c04 100644 --- a/docs/reference/bf_expr_template.html +++ b/docs/reference/bf_expr_template.html @@ -143,7 +143,7 @@
@@ -153,7 +153,7 @@

Expression template for Bayes Factor results

bf_expr_template(
   top.text,
-  estimate.df,
+  stats.df,
   prior.type = NULL,
   estimate.type = NULL,
   centrality = "median",
@@ -172,7 +172,7 @@ 

Arg mostly relevant in the context of ggstatsplot functions.

- estimate.df + stats.df

Dataframe containing estimates and their credible intervals along with Bayes Factor value. The columns should be named as estimate, estimate.LB, estimate.UB, and bf10.

diff --git a/docs/reference/expr_contingency_tab.html b/docs/reference/expr_contingency_tab.html index 55c80f1d..56802d03 100644 --- a/docs/reference/expr_contingency_tab.html +++ b/docs/reference/expr_contingency_tab.html @@ -6,7 +6,7 @@ -Making expression for contingency table analysis — expr_contingency_tab • statsExpressions +Expression and dataframe for contingency table analysis — expr_contingency_tab • statsExpressions @@ -54,8 +54,8 @@ - - + + @@ -142,13 +142,13 @@
-

Making expression for contingency table analysis

+

Expression and dataframe for contingency table analysis

expr_contingency_tab(
@@ -263,7 +263,7 @@ 

Arg

Value

-

Expression or a dataframe for contingency analysis (Pearson's +

Expression or a dataframe for contingency table analysis (Pearson's chi-square test for independence for between-subjects design or McNemar's test for within-subjects design) or goodness of fit test for a single categorical variable.

diff --git a/docs/reference/expr_corr_test.html b/docs/reference/expr_corr_test.html index 66a07333..16b8ade7 100644 --- a/docs/reference/expr_corr_test.html +++ b/docs/reference/expr_corr_test.html @@ -6,7 +6,7 @@ -Making expression for correlation analysis — expr_corr_test • statsExpressions +Expression and dataframe for correlation analysis — expr_corr_test • statsExpressions @@ -54,8 +54,8 @@ - - + + @@ -142,13 +142,13 @@
-

Making expression for correlation analysis

+

Expression and dataframe for correlation analysis

expr_corr_test(
diff --git a/docs/reference/expr_meta_random.html b/docs/reference/expr_meta_random.html
index 23a76fa2..f47c4d40 100644
--- a/docs/reference/expr_meta_random.html
+++ b/docs/reference/expr_meta_random.html
@@ -6,7 +6,7 @@
 
 
 
-Making expression for random-effects meta-analysis — expr_meta_random • statsExpressions
+Expression and dataframe for random-effects meta-analysis — expr_meta_random • statsExpressions
 
 
 
@@ -54,8 +54,8 @@
   
   
 
-
-
+
+
 
 
 
@@ -142,13 +142,13 @@
 
-

Making expression for random-effects meta-analysis

+

Expression and dataframe for random-effects meta-analysis

expr_meta_random(
diff --git a/docs/reference/expr_oneway_anova.html b/docs/reference/expr_oneway_anova.html
index f57724e4..343bcdf3 100644
--- a/docs/reference/expr_oneway_anova.html
+++ b/docs/reference/expr_oneway_anova.html
@@ -6,7 +6,7 @@
 
 
 
-Expression containing ANOVA results — expr_oneway_anova • statsExpressions
+Expression and dataframe for one-way ANOVA — expr_oneway_anova • statsExpressions
 
 
 
@@ -54,8 +54,8 @@
   
   
 
-
-
+
+
 
 
 
@@ -142,13 +142,13 @@
 
-

Expression containing ANOVA results

+

Expression and dataframe for one-way ANOVA

expr_oneway_anova(
@@ -228,11 +228,9 @@ 

Arg var.equal

a logical variable indicating whether to treat the - variances in the samples as equal. If TRUE, then a simple F - test for the equality of means in a one-way analysis of variance is - performed. If FALSE, an approximate method of Welch (1951) - is used, which generalizes the commonly known 2-sample Welch test to - the case of arbitrarily many samples.

+ two variances as being equal. If TRUE then the pooled + variance is used to estimate the variance otherwise the Welch + (or Satterthwaite) approximation to the degrees of freedom is used.

bf.prior diff --git a/docs/reference/expr_t_onesample.html b/docs/reference/expr_t_onesample.html index 796bbafc..c529b732 100644 --- a/docs/reference/expr_t_onesample.html +++ b/docs/reference/expr_t_onesample.html @@ -6,8 +6,7 @@ -Expression for one sample t-test and its non-parametric and -robust equivalents — expr_t_onesample • statsExpressions +Expression and dataframe for one-sample t-test — expr_t_onesample • statsExpressions @@ -55,10 +54,8 @@ - - + + @@ -145,15 +142,13 @@
-

Expression for one sample t-test and its non-parametric and -robust equivalents

+

Expression and dataframe for one-sample t-test

expr_t_onesample(
diff --git a/docs/reference/expr_t_twosample.html b/docs/reference/expr_t_twosample.html
index d94d00d7..30155217 100644
--- a/docs/reference/expr_t_twosample.html
+++ b/docs/reference/expr_t_twosample.html
@@ -6,7 +6,7 @@
 
 
 
-Making expression containing t-test results — expr_t_twosample • statsExpressions
+Expression and dataframe for two-sample t-test — expr_t_twosample • statsExpressions
 
 
 
@@ -54,8 +54,8 @@
   
   
 
-
-
+
+
 
 
 
@@ -142,13 +142,13 @@
 
-

Making expression containing t-test results

+

Expression and dataframe for two-sample t-test

expr_t_twosample(
@@ -227,11 +227,9 @@ 

Arg var.equal

a logical variable indicating whether to treat the - variances in the samples as equal. If TRUE, then a simple F - test for the equality of means in a one-way analysis of variance is - performed. If FALSE, an approximate method of Welch (1951) - is used, which generalizes the commonly known 2-sample Welch test to - the case of arbitrarily many samples.

+ two variances as being equal. If TRUE then the pooled + variance is used to estimate the variance otherwise the Welch + (or Satterthwaite) approximation to the degrees of freedom is used.

bf.prior diff --git a/docs/reference/expr_template.html b/docs/reference/expr_template.html index dce885e1..04013ae5 100644 --- a/docs/reference/expr_template.html +++ b/docs/reference/expr_template.html @@ -6,7 +6,7 @@ -Template for subtitles with statistical details for tests — expr_template • statsExpressions +Template for expressions with statistical details — expr_template • statsExpressions @@ -54,8 +54,8 @@ - - + + @@ -142,13 +142,13 @@
-

Template for subtitles with statistical details for tests

+

Template for expressions with statistical details

expr_template(
@@ -260,7 +260,7 @@ 

Examp conf.high = -1.088 ) -# subtitle for *t*-statistic with Cohen's *d* as effect size +# expression for *t*-statistic with Cohen's *d* as effect size statsExpressions::expr_template( no.parameters = 1L, stats.df = stats_df, diff --git a/docs/reference/index.html b/docs/reference/index.html index 13b62d44..edf937f7 100644 --- a/docs/reference/index.html +++ b/docs/reference/index.html @@ -169,14 +169,13 @@

expr_t_onesample()

-

Expression for one sample t-test and its non-parametric and -robust equivalents

+

Expression and dataframe for one-sample t-test

expr_t_twosample()

-

Making expression containing t-test results

+

Expression and dataframe for two-sample t-test

@@ -195,7 +194,7 @@

expr_oneway_anova()

-

Expression containing ANOVA results

+

Expression and dataframe for one-way ANOVA

@@ -214,7 +213,7 @@

expr_corr_test()

-

Making expression for correlation analysis

+

Expression and dataframe for correlation analysis

@@ -233,7 +232,7 @@

expr_contingency_tab()

-

Making expression for contingency table analysis

+

Expression and dataframe for contingency table analysis

@@ -252,7 +251,7 @@

expr_meta_random()

-

Making expression for random-effects meta-analysis

+

Expression and dataframe for random-effects meta-analysis

@@ -277,7 +276,7 @@

expr_template()

-

Template for subtitles with statistical details for tests

+

Template for expressions with statistical details

diff --git a/man/bf_expr_template.Rd b/man/bf_expr_template.Rd index 6386d287..2ac71e62 100644 --- a/man/bf_expr_template.Rd +++ b/man/bf_expr_template.Rd @@ -1,12 +1,12 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/bf_expr_template.R +% Please edit documentation in R/helpers_expr_templates.R \name{bf_expr_template} \alias{bf_expr_template} \title{Expression template for Bayes Factor results} \usage{ bf_expr_template( top.text, - estimate.df, + stats.df, prior.type = NULL, estimate.type = NULL, centrality = "median", @@ -20,7 +20,7 @@ bf_expr_template( \item{top.text}{Text to display on top of the Bayes Factor message. This is mostly relevant in the context of \code{ggstatsplot} functions.} -\item{estimate.df}{Dataframe containing estimates and their credible +\item{stats.df}{Dataframe containing estimates and their credible intervals along with Bayes Factor value. The columns should be named as \code{estimate}, \code{estimate.LB}, \code{estimate.UB}, and \code{bf10}.} diff --git a/man/expr_contingency_tab.Rd b/man/expr_contingency_tab.Rd index aec3e61f..985f33e7 100644 --- a/man/expr_contingency_tab.Rd +++ b/man/expr_contingency_tab.Rd @@ -2,7 +2,7 @@ % Please edit documentation in R/contingency_tabs.R \name{expr_contingency_tab} \alias{expr_contingency_tab} -\title{Making expression for contingency table analysis} +\title{Expression and dataframe for contingency table analysis} \usage{ expr_contingency_tab( data, @@ -81,13 +81,13 @@ results.} \item{...}{Additional arguments (currently ignored).} } \value{ -Expression or a dataframe for contingency analysis (Pearson's +Expression or a dataframe for contingency table analysis (Pearson's chi-square test for independence for between-subjects design or McNemar's test for within-subjects design) or goodness of fit test for a single categorical variable. } \description{ -Making expression for contingency table analysis +Expression and dataframe for contingency table analysis } \examples{ \donttest{ diff --git a/man/expr_corr_test.Rd b/man/expr_corr_test.Rd index b2e95084..b2d3a8b4 100644 --- a/man/expr_corr_test.Rd +++ b/man/expr_corr_test.Rd @@ -2,7 +2,7 @@ % Please edit documentation in R/corr_test.R \name{expr_corr_test} \alias{expr_corr_test} -\title{Making expression for correlation analysis} +\title{Expression and dataframe for correlation analysis} \usage{ expr_corr_test( data, @@ -64,7 +64,7 @@ intervals for the correlation coefficient estimate. Results are extracted via \code{correlation::correlation}. } \description{ -Making expression for correlation analysis +Expression and dataframe for correlation analysis } \examples{ # for reproducibility diff --git a/man/expr_meta_random.Rd b/man/expr_meta_random.Rd index 941b6cc6..d8b8084c 100644 --- a/man/expr_meta_random.Rd +++ b/man/expr_meta_random.Rd @@ -2,7 +2,7 @@ % Please edit documentation in R/meta_random.R \name{expr_meta_random} \alias{expr_meta_random} -\title{Making expression for random-effects meta-analysis} +\title{Expression and dataframe for random-effects meta-analysis} \usage{ expr_meta_random( data, @@ -51,7 +51,7 @@ results.} function.} } \description{ -Making expression for random-effects meta-analysis +Expression and dataframe for random-effects meta-analysis } \details{ This analysis is carried out using- diff --git a/man/expr_oneway_anova.Rd b/man/expr_oneway_anova.Rd index eb0baeba..c9ddbb73 100644 --- a/man/expr_oneway_anova.Rd +++ b/man/expr_oneway_anova.Rd @@ -2,7 +2,7 @@ % Please edit documentation in R/oneway_anova.R \name{expr_oneway_anova} \alias{expr_oneway_anova} -\title{Expression containing ANOVA results} +\title{Expression and dataframe for one-way ANOVA} \usage{ expr_oneway_anova( data, @@ -59,11 +59,9 @@ argument can be \code{"eta"} (partial eta-squared) or \code{"omega"} (partial omega-squared).} \item{var.equal}{a logical variable indicating whether to treat the - variances in the samples as equal. If \code{TRUE}, then a simple F - test for the equality of means in a one-way analysis of variance is - performed. If \code{FALSE}, an approximate method of Welch (1951) - is used, which generalizes the commonly known 2-sample Welch test to - the case of arbitrarily many samples.} + two variances as being equal. If \code{TRUE} then the pooled + variance is used to estimate the variance otherwise the Welch + (or Satterthwaite) approximation to the degrees of freedom is used.} \item{bf.prior}{A number between \code{0.5} and \code{2} (default \code{0.707}), the prior width to use in calculating Bayes factors.} @@ -91,7 +89,7 @@ For more details, see- \url{https://indrajeetpatil.github.io/statsExpressions/articles/stats_details.html} } \description{ -Expression containing ANOVA results +Expression and dataframe for one-way ANOVA } \examples{ \donttest{ diff --git a/man/expr_t_onesample.Rd b/man/expr_t_onesample.Rd index d5f12357..6bb503c0 100644 --- a/man/expr_t_onesample.Rd +++ b/man/expr_t_onesample.Rd @@ -2,8 +2,7 @@ % Please edit documentation in R/t_onesample.R \name{expr_t_onesample} \alias{expr_t_onesample} -\title{Expression for one sample \emph{t}-test and its non-parametric and -robust equivalents} +\title{Expression and dataframe for one-sample \emph{t}-test} \usage{ expr_t_onesample( data, @@ -71,8 +70,7 @@ and the effect size details contained will be dependent on the \code{type} argument. } \description{ -Expression for one sample \emph{t}-test and its non-parametric and -robust equivalents +Expression and dataframe for one-sample \emph{t}-test } \examples{ \donttest{ diff --git a/man/expr_t_twosample.Rd b/man/expr_t_twosample.Rd index 63edd5c5..07a2a768 100644 --- a/man/expr_t_twosample.Rd +++ b/man/expr_t_twosample.Rd @@ -2,7 +2,7 @@ % Please edit documentation in R/t_twosample.R \name{expr_t_twosample} \alias{expr_t_twosample} -\title{Making expression containing \emph{t}-test results} +\title{Expression and dataframe for two-sample \emph{t}-test} \usage{ expr_t_twosample( data, @@ -58,11 +58,9 @@ repeated measures/within-subjects or between-subjects. The default is argument can be \code{"d"} (for Cohen's \emph{d}) or \code{"g"} (for Hedge's \emph{g}).} \item{var.equal}{a logical variable indicating whether to treat the - variances in the samples as equal. If \code{TRUE}, then a simple F - test for the equality of means in a one-way analysis of variance is - performed. If \code{FALSE}, an approximate method of Welch (1951) - is used, which generalizes the commonly known 2-sample Welch test to - the case of arbitrarily many samples.} + two variances as being equal. If \code{TRUE} then the pooled + variance is used to estimate the variance otherwise the Welch + (or Satterthwaite) approximation to the degrees of freedom is used.} \item{bf.prior}{A number between \code{0.5} and \code{2} (default \code{0.707}), the prior width to use in calculating Bayes factors.} @@ -90,7 +88,7 @@ Expression containing details from results of a two-sample test and effect size plus confidence intervals. } \description{ -Making expression containing \emph{t}-test results +Expression and dataframe for two-sample \emph{t}-test } \note{ The \emph{stats::wilcox.test} function does not follow the same convention diff --git a/man/expr_template.Rd b/man/expr_template.Rd index eea3849f..c22b450e 100644 --- a/man/expr_template.Rd +++ b/man/expr_template.Rd @@ -1,8 +1,8 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/expr_template.R +% Please edit documentation in R/helpers_expr_templates.R \name{expr_template} \alias{expr_template} -\title{Template for subtitles with statistical details for tests} +\title{Template for expressions with statistical details} \usage{ expr_template( no.parameters, @@ -74,7 +74,7 @@ parameters (default: \code{0}).} \item{...}{Currently ignored.} } \description{ -Template for subtitles with statistical details for tests +Template for expressions with statistical details } \examples{ set.seed(123) @@ -90,7 +90,7 @@ stats_df <- conf.high = -1.088 ) -# subtitle for *t*-statistic with Cohen's *d* as effect size +# expression for *t*-statistic with Cohen's *d* as effect size statsExpressions::expr_template( no.parameters = 1L, stats.df = stats_df, diff --git a/tests/spelling.R b/tests/spelling.R index 6713838f..13f77d96 100644 --- a/tests/spelling.R +++ b/tests/spelling.R @@ -1,3 +1,6 @@ -if(requireNamespace('spelling', quietly = TRUE)) - spelling::spell_check_test(vignettes = TRUE, error = FALSE, - skip_on_cran = TRUE) +if (requireNamespace("spelling", quietly = TRUE)) { + spelling::spell_check_test( + vignettes = TRUE, error = FALSE, + skip_on_cran = TRUE + ) +} diff --git a/tests/testthat/test-expr_templates.R b/tests/testthat/test-expr_templates.R index 048bd07d..7a58344b 100644 --- a/tests/testthat/test-expr_templates.R +++ b/tests/testthat/test-expr_templates.R @@ -196,3 +196,12 @@ test_that( expect_identical(subtitle, template_1) } ) + + +test_that( + desc = "switches default to NULL", + code = { + expect_null(estimate_type_switch("x")) + expect_null(stat_text_switch("x")) + } +)