diff --git a/.Rbuildignore b/.Rbuildignore index e9409319..621d430e 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -1,6 +1,7 @@ .ls-lint.yml ^.*\.Rproj$ -^.gitlab-ci\.yaml$ +^.dev$ +^.gitlab-ci\.yml$ ^API$ ^CITATION\.cff$ ^CODE_OF_CONDUCT\.md$ @@ -19,22 +20,20 @@ ^WIP/. ^\.Rproj\.user$ ^\.circleci$ -^\.coveralls\.yaml$ +^\.coveralls\.yml$ ^\.covrignore$ ^\.github$ ^\.github/ISSUE_TEMPLATE$ ^\.github/workflows/R\.yaml$ ^\.github/workflows/pr-commands\.yaml$ -^\.gitsum$ ^\.httr-oauth$ ^\.lintr$ ^\.pre-commit-config\.yaml$ -^\.travis\.yaml$ +^\.travis\.yml$ ^\cache$ ^_pkgdown\.yaml$ ^_pkgdown\.yml$ -^appveyor\.yaml$ -^brew\-log$ +^appveyor\.yml$ ^codecov\.yaml$ ^codemeta\.json$ ^cran-comments\.md$ @@ -42,14 +41,13 @@ ^doc$ ^docs$ ^gitsum$ +^hextools/. ^man-roxygen$ +^old/. ^paper.*$ ^pkgdown$ ^revdep$ +^shell$ ^tests/manual$ -^tests/testmanual$ -hextools publication/* references.bib -shell -tests\^spelling diff --git a/vignettes/stats_details.Rmd b/.dev/stats_details.Rmd similarity index 74% rename from vignettes/stats_details.Rmd rename to .dev/stats_details.Rmd index be0df5db..0848b57d 100644 --- a/vignettes/stats_details.Rmd +++ b/.dev/stats_details.Rmd @@ -4,19 +4,26 @@ output: rmarkdown::html_vignette: toc: true toc_depth: 4 + keep_md: true vignette: > %\VignetteIndexEntry{Test and effect size details} %\VignetteEngine{knitr::rmarkdown} %\VignetteEncoding{UTF-8} --- -```{r} +```{r setup} #| label = "setup", #| message = FALSE, #| warning = FALSE, #| include = FALSE, #| echo = FALSE -source("setup.R") +source("../setup.R") + +# TODO: check if the pkgdown issue with child document path is resolved # nolint. +# for now, run `rmarkdown::render("vignettes/web_only/stats_details.Rmd")` from root directory +knitr::opts_chunk$set( + eval = if (identical(Sys.getenv("IN_PKGDOWN"), "true")) FALSE else TRUE +) ``` This vignette can be cited as: @@ -38,7 +45,7 @@ Abbreviations used: CI = Confidence Interval ## Summary of functionality -```{r child="../man/rmd-fragments/functionality.Rmd"} +```{r child="../../man/rmd-fragments/functionality.Rmd"} ``` ## Summary of tests and effect sizes @@ -52,37 +59,37 @@ more about how one-way (between-subjects) ANOVA, you can run ### `centrality_description()` -```{r child="../man/rmd-fragments/centrality_description.Rmd"} +```{r child="../../man/rmd-fragments/centrality_description.Rmd"} ``` ### `oneway_anova()` -```{r child="../man/rmd-fragments/oneway_anova.Rmd"} +```{r child="../../man/rmd-fragments/oneway_anova.Rmd"} ``` ### `two_sample_test()` -```{r child="../man/rmd-fragments/two_sample_test.Rmd"} +```{r child="../../man/rmd-fragments/two_sample_test.Rmd"} ``` ### `one_sample_test()` -```{r child="../man/rmd-fragments/one_sample_test.Rmd"} +```{r child="../../man/rmd-fragments/one_sample_test.Rmd"} ``` ### `corr_test()` -```{r child="../man/rmd-fragments/corr_test.Rmd"} +```{r child="../../man/rmd-fragments/corr_test.Rmd"} ``` ### `contingency_table()` -```{r child="../man/rmd-fragments/contingency_table.Rmd"} +```{r child="../../man/rmd-fragments/contingency_table.Rmd"} ``` ### `meta_analysis()` -```{r child="../man/rmd-fragments/meta_analysis.Rmd"} +```{r child="../../man/rmd-fragments/meta_analysis.Rmd"} ``` ## Effect size interpretation diff --git a/.github/workflows/R-CMD-check-hard.yaml b/.github/workflows/R-CMD-check-hard.yaml index 7174722e..a6d84048 100644 --- a/.github/workflows/R-CMD-check-hard.yaml +++ b/.github/workflows/R-CMD-check-hard.yaml @@ -45,6 +45,7 @@ jobs: any::rmarkdown any::curl any::testthat + any::patrick needs: check - uses: r-lib/actions/check-r-package@v2 diff --git a/.github/workflows/styler.yaml b/.github/workflows/styler.yaml index 263ca859..7fff05af 100644 --- a/.github/workflows/styler.yaml +++ b/.github/workflows/styler.yaml @@ -30,12 +30,11 @@ jobs: local::. r-lib/pkgapi r-lib/styler - any::roxygen2 + r-lib/roxygen2 + any::metaplus anthonynorth/roxyglobals needs: | - metaplus - styler - roxygen2 + check - name: Enable styler cache run: | diff --git a/.gitignore b/.gitignore index 7a587c9b..d4c65448 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ Meta doc +docs # Windows image file caches Thumbs.db ehthumbs.db @@ -37,6 +38,7 @@ $RECYCLE.BIN/ Network Trash Folder Temporary Items # R Studio files +*.html .RData .Rhistory .Rproj.user diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 96c6bdad..c67491fc 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -6,7 +6,7 @@ default_language_version: repos: - repo: https://github.com/lorenzwalthert/precommit - rev: v0.4.2 + rev: v0.4.3 hooks: - id: no-browser-statement - id: no-debug-statement diff --git a/CITATION.cff b/CITATION.cff index 26f8add6..00133b98 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -97,7 +97,7 @@ references: given-names: Mattan S. year: '2024' doi: 10.32614/CRAN.package.afex - version: '>= 1.3-1' + version: '>= 1.4-1' - type: software title: BayesFactor abstract: 'BayesFactor: Computation of Bayes Factors for Common Designs' @@ -181,7 +181,7 @@ references: orcid: https://orcid.org/0000-0001-9560-6336 year: '2024' doi: 10.32614/CRAN.package.datawizard - version: '>= 0.12.2' + version: '>= 0.12.3' - type: software title: dplyr abstract: 'dplyr: A Grammar of Data Manipulation' @@ -304,7 +304,7 @@ references: orcid: https://orcid.org/0000-0002-9271-5075 year: '2024' doi: 10.32614/CRAN.package.insight - version: '>= 0.20.2' + version: '>= 0.20.4' - type: software title: magrittr abstract: 'magrittr: A Forward-Pipe Operator for R' @@ -353,7 +353,7 @@ references: orcid: https://orcid.org/0000-0001-9560-6336 year: '2024' doi: 10.32614/CRAN.package.parameters - version: '>= 0.22.1' + version: '>= 0.22.2' - type: software title: performance abstract: 'performance: Assessment of Regression Models Performance' @@ -391,7 +391,7 @@ references: orcid: https://orcid.org/0000-0003-4315-6788 year: '2024' doi: 10.32614/CRAN.package.performance - version: '>= 0.12.2' + version: '>= 0.12.3' - type: software title: PMCMRplus abstract: 'PMCMRplus: Calculate Pairwise Multiple Comparisons of Mean Rank Sums @@ -449,7 +449,6 @@ references: name: R Foundation for Statistical Computing address: Vienna, Austria year: '2024' - doi: 10.32614/CRAN.package.stats - type: software title: tibble abstract: 'tibble: Simple Data Frames' @@ -510,7 +509,7 @@ references: given-names: Winston year: '2024' doi: 10.32614/CRAN.package.withr - version: '>= 3.0.0' + version: '>= 3.0.1' - type: software title: WRS2 abstract: 'WRS2: A Collection of Robust Statistical Methods' @@ -545,7 +544,7 @@ references: abstract: 'bayestestR: Understand and Describe Bayesian Models and Posterior Distributions' notes: Suggests url: https://easystats.github.io/bayestestR/ - repository: https://easystats.r-universe.dev + repository: https://CRAN.R-project.org/package=bayestestR authors: - family-names: Makowski given-names: Dominique @@ -676,6 +675,18 @@ references: year: '2024' doi: 10.32614/CRAN.package.metaplus version: '>= 1.0-5' +- type: software + title: patrick + abstract: 'patrick: Parameterized Unit Testing' + notes: Suggests + url: https://github.com/google/patrick + repository: https://CRAN.R-project.org/package=patrick + authors: + - family-names: Quinn + given-names: Michael + email: msquinn@google.com + year: '2024' + doi: 10.32614/CRAN.package.patrick - type: software title: rmarkdown abstract: 'rmarkdown: Dynamic Documents for R' @@ -775,4 +786,3 @@ references: name: R Foundation for Statistical Computing address: Vienna, Austria year: '2024' - doi: 10.32614/CRAN.package.utils diff --git a/DESCRIPTION b/DESCRIPTION index 81266795..fba6c7d0 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,10 +1,9 @@ Type: Package Package: statsExpressions Title: Tidy Dataframes and Expressions with Statistical Details -Version: 1.5.5.9000 +Version: 1.6.0 Authors@R: - person("Indrajeet", "Patil", , "patilindrajeet.science@gmail.com", role = c("cre", "aut", "cph"), - comment = c(ORCID = "0000-0003-1995-6531", Twitter = "@patilindrajeets")) + person("Indrajeet", "Patil", , "patilindrajeet.science@gmail.com", role = c("cre", "aut", "cph")) Maintainer: Indrajeet Patil Description: Utilities for producing dataframes with rich details for the most common types of statistical approaches and tests: parametric, @@ -22,24 +21,24 @@ BugReports: https://github.com/IndrajeetPatil/statsExpressions/issues Depends: R (>= 4.1.0) Imports: - afex (>= 1.3-1), + afex (>= 1.4-1), BayesFactor (>= 0.9.12-4.7), correlation (>= 0.8.5), - datawizard (>= 0.12.2), + datawizard (>= 0.12.3), dplyr (>= 1.1.4), effectsize (>= 0.8.9), glue (>= 1.7.0), - insight (>= 0.20.2), + insight (>= 0.20.4), magrittr (>= 2.0.3), - parameters (>= 0.22.1), - performance (>= 0.12.2), + parameters (>= 0.22.2), + performance (>= 0.12.3), PMCMRplus (>= 1.9.10), purrr (>= 1.0.2), rlang (>= 1.1.4), stats, tibble (>= 3.2.1), tidyr (>= 1.3.1), - withr (>= 3.0.0), + withr (>= 3.0.1), WRS2 (>= 1.1-6), zeallot (>= 0.1.0) Suggests: @@ -49,6 +48,7 @@ Suggests: metaBMA, metafor, metaplus (>= 1.0-5), + patrick, rmarkdown, rstantools, survival, @@ -65,4 +65,4 @@ Language: en-US LazyData: true Roxygen: list( markdown = TRUE, roclets = c("collate", "namespace", "rd", "pkgapi::api_roclet", "roxyglobals::global_roclet") ) -RoxygenNote: 7.3.2 +RoxygenNote: 7.3.2.9000 diff --git a/NEWS.md b/NEWS.md index c7595567..378d49d5 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,4 +1,11 @@ -# statsExpressions 1.5.5.9000 +# statsExpressions 1.6.0 + +## MAJOR CHANGES + +- _Test and effect size details_ vignette is now available only on the package + website (https://indrajeetpatil.github.io/statsExpressions/articles/). + +- Unused dataset has been removed: `movies_wide`. # statsExpressions 1.5.5 diff --git a/R/data.R b/R/data.R index b975b8b8..281db764 100644 --- a/R/data.R +++ b/R/data.R @@ -1,49 +1,7 @@ -#' @title Movie information and user ratings from IMDB.com (wide format). -#' @name movies_wide -#' @details Modified dataset from `{ggplot2movies}` package. -#' -#' The internet movie database, , is a website devoted -#' to collecting movie data supplied by studios and fans. It claims to be the -#' biggest movie database on the web and is run by amazon. -#' -#' Movies were selected for inclusion if they had a known length and had been -#' rated by at least one IMDB user. Small categories such as documentaries -#' and NC-17 movies were removed. -#' -#' @format A data frame with 1,579 rows and 13 variables -#' -#' - title. Title of the movie. -#' - year. Year of release. -#' - budget. Total budget in millions of US dollars -#' - length. Length in minutes. -#' - rating. Average IMDB user rating. -#' - votes. Number of IMDB users who rated this movie. -#' - mpaa. MPAA rating. -#' - action, animation, comedy, drama, documentary, romance, short. Binary -#' variables representing if movie was classified as belonging to that genre. -#' - NumGenre. The number of different genres a film was classified in an -#' integer between one and four. -#' -#' @source -#' -#' @examples -#' dim(movies_wide) -#' head(movies_wide) -#' dplyr::glimpse(movies_wide) -"movies_wide" - -#' @title Movie information and user ratings from IMDB.com (long format). +#' @title Movie information and user ratings from IMDB. #' @name movies_long #' @details Modified dataset from `{ggplot2movies}` package. #' -#' The internet movie database, , is a website devoted -#' to collecting movie data supplied by studios and fans. It claims to be the -#' biggest movie database on the web and is run by amazon. -#' -#' Movies were are identical to those selected for inclusion in movies_wide but this -#' dataset has been constructed such that every movie appears in one and only one -#' genre category. -#' #' @format A data frame with 1,579 rows and 8 variables #' #' - title. Title of the movie. @@ -114,8 +72,12 @@ #' - desire. The desire to kill an arthropod was indicated on a scale from #' 0 to 10. #' -#' @source -#' +#' @references +#' +#' Ryan, R. S., Wilde, M., & Crist, S. (2013). Compared to a small, supervised +#' lab experiment, a large, unsupervised web-based experiment on a previously +#' unknown effect has benefits that outweigh its potential costs. *Computers in +#' Human Behavior*, *29*(4), 1295-1301. #' #' @examples #' dim(bugs_long) diff --git a/R/oneway-anova.R b/R/oneway-anova.R index ffbdbd0e..c8c44131 100644 --- a/R/oneway-anova.R +++ b/R/oneway-anova.R @@ -43,7 +43,7 @@ #' #' @autoglobal #' -#' @examplesIf identical(Sys.getenv("NOT_CRAN"), "true") && getRversion() >= "4.4.0" +#' @examplesIf identical(Sys.getenv("NOT_CRAN"), "true") #' # for reproducibility #' set.seed(123) #' library(statsExpressions) @@ -106,7 +106,7 @@ #' type = "r" #' ) #' -#' @examplesIf identical(Sys.getenv("NOT_CRAN"), "true") && requireNamespace("rstantools") && getRversion() >= "4.4.0" +#' @examplesIf identical(Sys.getenv("NOT_CRAN"), "true") && requireNamespace("rstantools") #' #' # ----------------------- Bayesian ------------------------------------- #' diff --git a/README.Rmd b/README.Rmd index d1ac4e2d..bb1a6c88 100644 --- a/README.Rmd +++ b/README.Rmd @@ -47,7 +47,6 @@ On Linux, `{statsExpressions}` installation may require additional system depend pak::pkg_sysreqs("statsExpressions") ``` - # Citation The package can be cited as: diff --git a/README.md b/README.md index e10b4a3d..053a72a4 100644 --- a/README.md +++ b/README.md @@ -64,13 +64,14 @@ citation("statsExpressions") To cite package 'statsExpressions' in publications use: Patil, I., (2021). statsExpressions: R Package for Tidy Dataframes - and Expressions with Statistical Details. *Journal of Open Source - Software*, *6*(61), 3236, https://doi.org/10.21105/joss.03236 + and Expressions with Statistical Details. Journal of Open Source + Software, 6(61), 3236, https://doi.org/10.21105/joss.03236 A BibTeX entry for LaTeX users is @Article{, doi = {10.21105/joss.03236}, + url = {https://doi.org/10.21105/joss.03236}, year = {2021}, publisher = {{The Open Journal}}, volume = {6}, @@ -141,9 +142,6 @@ mtcars %>% oneway_anova(cyl, wt, type = "nonparametric") #> conf.high conf.method conf.iterations n.obs expression #> #> 1 1 percentile bootstrap 100 32 -``` - -``` r mtcars %>% oneway_anova(cyl, wt, type = "robust") #> # A tibble: 1 × 12 @@ -490,9 +488,6 @@ set.seed(123) #> list(italic("F")["Fisher"](2, 147) == "119.26", italic(p) == #> "1.67e-31", widehat(omega["p"]^2) == "0.61", CI["95%"] ~ #> "[" * "0.53", "1.00" * "]", italic("n")["obs"] == "150") -``` - -``` r # adapting the details to your liking ggplot(iris, aes(x = Species, y = Sepal.Length)) + diff --git a/codemeta.json b/codemeta.json index 090c3492..9abfb6b7 100644 --- a/codemeta.json +++ b/codemeta.json @@ -123,6 +123,18 @@ }, "sameAs": "https://CRAN.R-project.org/package=metaplus" }, + { + "@type": "SoftwareApplication", + "identifier": "patrick", + "name": "patrick", + "provider": { + "@id": "https://cran.r-project.org", + "@type": "Organization", + "name": "Comprehensive R Archive Network (CRAN)", + "url": "https://cran.r-project.org" + }, + "sameAs": "https://CRAN.R-project.org/package=patrick" + }, { "@type": "SoftwareApplication", "identifier": "rmarkdown", @@ -189,7 +201,7 @@ "@type": "SoftwareApplication", "identifier": "afex", "name": "afex", - "version": ">= 1.3-1", + "version": ">= 1.4-1", "provider": { "@id": "https://cran.r-project.org", "@type": "Organization", @@ -228,7 +240,7 @@ "@type": "SoftwareApplication", "identifier": "datawizard", "name": "datawizard", - "version": ">= 0.12.2", + "version": ">= 0.12.3", "provider": { "@id": "https://cran.r-project.org", "@type": "Organization", @@ -280,7 +292,7 @@ "@type": "SoftwareApplication", "identifier": "insight", "name": "insight", - "version": ">= 0.20.2", + "version": ">= 0.20.4", "provider": { "@id": "https://cran.r-project.org", "@type": "Organization", @@ -306,7 +318,7 @@ "@type": "SoftwareApplication", "identifier": "parameters", "name": "parameters", - "version": ">= 0.22.1", + "version": ">= 0.22.2", "provider": { "@id": "https://cran.r-project.org", "@type": "Organization", @@ -319,7 +331,7 @@ "@type": "SoftwareApplication", "identifier": "performance", "name": "performance", - "version": ">= 0.12.2", + "version": ">= 0.12.3", "provider": { "@id": "https://cran.r-project.org", "@type": "Organization", @@ -402,7 +414,7 @@ "@type": "SoftwareApplication", "identifier": "withr", "name": "withr", - "version": ">= 3.0.0", + "version": ">= 3.0.1", "provider": { "@id": "https://cran.r-project.org", "@type": "Organization", @@ -439,7 +451,7 @@ }, "SystemRequirements": null }, - "fileSize": "4129.212KB", + "fileSize": "4135.693KB", "citation": [ { "@type": "ScholarlyArticle", diff --git a/cran-comments.md b/cran-comments.md index ed830d6b..5fe21fdf 100644 --- a/cran-comments.md +++ b/cran-comments.md @@ -2,7 +2,7 @@ 0 errors | 0 warnings | 0 note -* Updates code to fix warnings coming via updates to easystats packages. +* Fixes CRAN vignette build failures on R-oldrel. ## revdepcheck results diff --git a/data/movies_wide.rdata b/data/movies_wide.rdata deleted file mode 100644 index 343d0008..00000000 Binary files a/data/movies_wide.rdata and /dev/null differ diff --git a/inst/WORDLIST b/inst/WORDLIST index 02d2f8e1..dade5862 100644 --- a/inst/WORDLIST +++ b/inst/WORDLIST @@ -6,6 +6,7 @@ Codecov Conover Cramer's Cramer’s +Crist Cushman DOI Durbin @@ -21,7 +22,6 @@ MPAA McNemar's McNemar’s Mina -NumGenre ORCID Otterstetter Penfield diff --git a/man/bugs_long.Rd b/man/bugs_long.Rd index bf68e688..d3837020 100644 --- a/man/bugs_long.Rd +++ b/man/bugs_long.Rd @@ -20,9 +20,6 @@ disgustingness). 0 to 10. } } -\source{ -\url{https://www.sciencedirect.com/science/article/pii/S0747563213000277} -} \usage{ bugs_long } @@ -40,4 +37,10 @@ dim(bugs_long) head(bugs_long) dplyr::glimpse(bugs_long) } +\references{ +Ryan, R. S., Wilde, M., & Crist, S. (2013). Compared to a small, supervised +lab experiment, a large, unsupervised web-based experiment on a previously +unknown effect has benefits that outweigh its potential costs. \emph{Computers in +Human Behavior}, \emph{29}(4), 1295-1301. +} \keyword{datasets} diff --git a/man/figures/README-anova_parametric2-1.png b/man/figures/README-anova_parametric2-1.png index 3f6c5bbd..b71cc504 100644 Binary files a/man/figures/README-anova_parametric2-1.png and b/man/figures/README-anova_parametric2-1.png differ diff --git a/man/figures/README-anova_rob1-1.png b/man/figures/README-anova_rob1-1.png index 7640f481..b3593813 100644 Binary files a/man/figures/README-anova_rob1-1.png and b/man/figures/README-anova_rob1-1.png differ diff --git a/man/meta_analysis.Rd b/man/meta_analysis.Rd index 6108ec65..083574a5 100644 --- a/man/meta_analysis.Rd +++ b/man/meta_analysis.Rd @@ -106,12 +106,12 @@ Patil, I., (2021). statsExpressions: R Package for Tidy Dataframes and Expressio } \examples{ -\dontshow{if (identical(Sys.getenv("NOT_CRAN"), "true") && requireNamespace("metafor", quietly = TRUE)) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (identical(Sys.getenv("NOT_CRAN"), "true") && requireNamespace("metafor", quietly = TRUE)) withAutoprint(\{ # examplesIf} # setup set.seed(123) library(statsExpressions) \dontshow{\}) # examplesIf} -\dontshow{if (requireNamespace("metaplus", quietly = TRUE)) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (requireNamespace("metaplus", quietly = TRUE)) withAutoprint(\{ # examplesIf} # let's use `mag` dataset from `{metaplus}` data(mag, package = "metaplus") @@ -121,13 +121,13 @@ dat <- dplyr::rename(mag, estimate = yi, std.error = sei) meta_analysis(dat) \dontshow{\}) # examplesIf} -\dontshow{if (identical(Sys.getenv("NOT_CRAN"), "true") && requireNamespace("metaplus", quietly = TRUE)) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (identical(Sys.getenv("NOT_CRAN"), "true") && requireNamespace("metaplus", quietly = TRUE)) withAutoprint(\{ # examplesIf} # ----------------------- robust ---------------------------------- meta_analysis(dat, type = "random", random = "normal") \dontshow{\}) # examplesIf} -\dontshow{if (identical(Sys.getenv("NOT_CRAN"), "true") && requireNamespace("metaBMA", quietly = TRUE)) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (identical(Sys.getenv("NOT_CRAN"), "true") && requireNamespace("metaBMA", quietly = TRUE)) withAutoprint(\{ # examplesIf} # ----------------------- Bayesian ---------------------------------- diff --git a/man/movies_long.Rd b/man/movies_long.Rd index a531dfb2..b867e131 100644 --- a/man/movies_long.Rd +++ b/man/movies_long.Rd @@ -3,7 +3,7 @@ \docType{data} \name{movies_long} \alias{movies_long} -\title{Movie information and user ratings from IMDB.com (long format).} +\title{Movie information and user ratings from IMDB.} \format{ A data frame with 1,579 rows and 8 variables \itemize{ @@ -25,18 +25,10 @@ documentary, romance, short). movies_long } \description{ -Movie information and user ratings from IMDB.com (long format). +Movie information and user ratings from IMDB. } \details{ Modified dataset from \code{{ggplot2movies}} package. - -The internet movie database, \url{https://imdb.com/}, is a website devoted -to collecting movie data supplied by studios and fans. It claims to be the -biggest movie database on the web and is run by amazon. - -Movies were are identical to those selected for inclusion in movies_wide but this -dataset has been constructed such that every movie appears in one and only one -genre category. } \examples{ dim(movies_long) diff --git a/man/movies_wide.Rd b/man/movies_wide.Rd deleted file mode 100644 index c69b60a8..00000000 --- a/man/movies_wide.Rd +++ /dev/null @@ -1,48 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/data.R -\docType{data} -\name{movies_wide} -\alias{movies_wide} -\title{Movie information and user ratings from IMDB.com (wide format).} -\format{ -A data frame with 1,579 rows and 13 variables -\itemize{ -\item title. Title of the movie. -\item year. Year of release. -\item budget. Total budget in millions of US dollars -\item length. Length in minutes. -\item rating. Average IMDB user rating. -\item votes. Number of IMDB users who rated this movie. -\item mpaa. MPAA rating. -\item action, animation, comedy, drama, documentary, romance, short. Binary -variables representing if movie was classified as belonging to that genre. -\item NumGenre. The number of different genres a film was classified in an -integer between one and four. -} -} -\source{ -\url{https://CRAN.R-project.org/package=ggplot2movies} -} -\usage{ -movies_wide -} -\description{ -Movie information and user ratings from IMDB.com (wide format). -} -\details{ -Modified dataset from \code{{ggplot2movies}} package. - -The internet movie database, \url{https://imdb.com/}, is a website devoted -to collecting movie data supplied by studios and fans. It claims to be the -biggest movie database on the web and is run by amazon. - -Movies were selected for inclusion if they had a known length and had been -rated by at least one IMDB user. Small categories such as documentaries -and NC-17 movies were removed. -} -\examples{ -dim(movies_wide) -head(movies_wide) -dplyr::glimpse(movies_wide) -} -\keyword{datasets} diff --git a/man/oneway_anova.Rd b/man/oneway_anova.Rd index 346e45b5..2a67c096 100644 --- a/man/oneway_anova.Rd +++ b/man/oneway_anova.Rd @@ -180,7 +180,7 @@ Patil, I., (2021). statsExpressions: R Package for Tidy Dataframes and Expressio } \examples{ -\dontshow{if (identical(Sys.getenv("NOT_CRAN"), "true") && getRversion() >= "4.4.0") (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (identical(Sys.getenv("NOT_CRAN"), "true")) withAutoprint(\{ # examplesIf} # for reproducibility set.seed(123) library(statsExpressions) @@ -243,7 +243,7 @@ oneway_anova( type = "r" ) \dontshow{\}) # examplesIf} -\dontshow{if (identical(Sys.getenv("NOT_CRAN"), "true") && requireNamespace("rstantools") && getRversion() >= "4.4.0") (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (identical(Sys.getenv("NOT_CRAN"), "true") && requireNamespace("rstantools")) withAutoprint(\{ # examplesIf} # ----------------------- Bayesian ------------------------------------- diff --git a/man/pairwise_comparisons.Rd b/man/pairwise_comparisons.Rd index fa0faed1..1cb8b01d 100644 --- a/man/pairwise_comparisons.Rd +++ b/man/pairwise_comparisons.Rd @@ -163,7 +163,7 @@ Patil, I., (2021). statsExpressions: R Package for Tidy Dataframes and Expressio } \examples{ -\dontshow{if (identical(Sys.getenv("NOT_CRAN"), "true")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (identical(Sys.getenv("NOT_CRAN"), "true")) withAutoprint(\{ # examplesIf} # for reproducibility set.seed(123) library(statsExpressions) diff --git a/man/statsExpressions-package.Rd b/man/statsExpressions-package.Rd index 06244b19..bb36887a 100644 --- a/man/statsExpressions-package.Rd +++ b/man/statsExpressions-package.Rd @@ -45,7 +45,7 @@ Useful links: } \author{ -\strong{Maintainer}: Indrajeet Patil \email{patilindrajeet.science@gmail.com} (\href{https://orcid.org/0000-0003-1995-6531}{ORCID}) (@patilindrajeets) [copyright holder] +\strong{Maintainer}: Indrajeet Patil \email{patilindrajeet.science@gmail.com} [copyright holder] } \keyword{internal} diff --git a/man/tidy_model_expressions.Rd b/man/tidy_model_expressions.Rd index bc4bbd3d..4e341944 100644 --- a/man/tidy_model_expressions.Rd +++ b/man/tidy_model_expressions.Rd @@ -45,7 +45,7 @@ Patil, I., (2021). statsExpressions: R Package for Tidy Dataframes and Expressio } \examples{ -\dontshow{if (identical(Sys.getenv("NOT_CRAN"), "true")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (identical(Sys.getenv("NOT_CRAN"), "true")) withAutoprint(\{ # examplesIf} # setup set.seed(123) library(statsExpressions) diff --git a/man/two_sample_test.Rd b/man/two_sample_test.Rd index 676438c6..54e3bbf5 100644 --- a/man/two_sample_test.Rd +++ b/man/two_sample_test.Rd @@ -185,7 +185,7 @@ Patil, I., (2021). statsExpressions: R Package for Tidy Dataframes and Expressio } \examples{ -\dontshow{if (identical(Sys.getenv("NOT_CRAN"), "true")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (identical(Sys.getenv("NOT_CRAN"), "true")) withAutoprint(\{ # examplesIf} \dontshow{\}) # examplesIf} # ----------------------- within-subjects ------------------------------------- diff --git a/pkgdown/_pkgdown.yml b/pkgdown/_pkgdown.yml index c6c64403..132f1c6b 100644 --- a/pkgdown/_pkgdown.yml +++ b/pkgdown/_pkgdown.yml @@ -78,7 +78,6 @@ reference: - title: Data desc: Datasets included in the package. contents: - - movies_wide - movies_long - iris_long - bugs_long diff --git a/tests/testthat.R b/tests/testthat.R index 18138784..a5aeffcd 100644 --- a/tests/testthat.R +++ b/tests/testthat.R @@ -1,4 +1,5 @@ library(testthat) +library(patrick) library(statsExpressions) test_check("statsExpressions") diff --git a/tests/testthat/_snaps/centrality-description.md b/tests/testthat/_snaps/centrality-description.md index 54401d39..7e88f2ff 100644 --- a/tests/testthat/_snaps/centrality-description.md +++ b/tests/testthat/_snaps/centrality-description.md @@ -3,35 +3,27 @@ Code select(df, -expression) Output - # A tibble: 12 x 14 - Species Sepal.Length std.dev iqr conf.low conf.high min max skewness - - 1 setosa 5.01 0.352 0.400 4.93 5.09 4.3 5.8 0.120 - 2 versicolor 5.94 0.516 0.7 5.82 6.05 4.9 7 0.105 - 3 virginica 6.59 0.636 0.750 6.46 6.75 4.9 7.9 0.118 - 4 setosa 5 NA 0.400 4.9 5.1 4.3 5.8 0.120 - 5 versicolor 5.9 NA 0.7 5.65 6.1 4.9 7 0.105 - 6 virginica 6.5 NA 0.750 6.32 6.7 4.9 7.9 0.118 - 7 setosa 5 0.352 0.400 4.92 5.09 4.3 5.8 0.120 - 8 versicolor 5.91 0.516 0.7 5.81 6.07 4.9 7 0.105 - 9 virginica 6.55 0.636 0.750 6.42 6.71 4.9 7.9 0.118 - 10 setosa 5.02 NA 0.400 5.00 5.05 4.3 5.8 0.120 - 11 versicolor 5.75 NA 0.7 5.63 5.85 4.9 7 0.105 - 12 virginica 6.40 NA 0.750 6.34 6.42 4.9 7.9 0.118 - kurtosis n.obs missing.obs n.expression mad - - 1 -0.253 50 0 "setosa\n(n = 50)" NA - 2 -0.533 50 0 "versicolor\n(n = 50)" NA - 3 0.0329 50 0 "virginica\n(n = 50)" NA - 4 -0.253 50 0 "setosa\n(n = 50)" 0.297 - 5 -0.533 50 0 "versicolor\n(n = 50)" 0.519 - 6 0.0329 50 0 "virginica\n(n = 50)" 0.593 - 7 -0.253 50 0 "setosa\n(n = 50)" NA - 8 -0.533 50 0 "versicolor\n(n = 50)" NA - 9 0.0329 50 0 "virginica\n(n = 50)" NA - 10 -0.253 50 0 "setosa\n(n = 50)" NA - 11 -0.533 50 0 "versicolor\n(n = 50)" NA - 12 0.0329 50 0 "virginica\n(n = 50)" NA + # A tibble: 8 x 14 + am wt std.dev iqr conf.low conf.high min max skewness kurtosis + + 1 0 3.77 0.777 0.41 3.48 4.09 2.46 5.42 1.15 1.06 + 2 1 2.41 0.617 0.942 2.20 2.69 1.51 3.57 0.269 -0.654 + 3 0 3.52 NA 0.41 3.44 3.84 2.46 5.42 1.15 1.06 + 4 1 2.32 NA 0.942 1.99 3.17 1.51 3.57 0.269 -0.654 + 5 0 3.60 0.777 0.41 3.46 4.05 2.46 5.42 1.15 1.06 + 6 1 2.39 0.617 0.942 2.06 2.74 1.51 3.57 0.269 -0.654 + 7 0 3.47 NA 0.41 3.44 3.53 2.46 5.42 1.15 1.06 + 8 1 2.34 NA 0.942 2.01 2.76 1.51 3.57 0.269 -0.654 + n.obs missing.obs n.expression mad + + 1 19 0 "0\n(n = 19)" NA + 2 13 0 "1\n(n = 13)" NA + 3 19 0 "0\n(n = 19)" 0.452 + 4 13 0 "1\n(n = 13)" 0.682 + 5 19 0 "0\n(n = 19)" NA + 6 13 0 "1\n(n = 13)" NA + 7 19 0 "0\n(n = 19)" NA + 8 13 0 "1\n(n = 13)" NA --- @@ -39,40 +31,28 @@ df[["expression"]] Output [[1]] - list(widehat(mu)[mean] == "5.01") + list(widehat(mu)[mean] == "3.769") [[2]] - list(widehat(mu)[mean] == "5.94") + list(widehat(mu)[mean] == "2.411") [[3]] - list(widehat(mu)[mean] == "6.59") + list(widehat(mu)[median] == "3.520") [[4]] - list(widehat(mu)[median] == "5.000") + list(widehat(mu)[median] == "2.320") [[5]] - list(widehat(mu)[median] == "5.900") + list(widehat(mu)[trimmed] == "3.599") [[6]] - list(widehat(mu)[median] == "6.500") + list(widehat(mu)[trimmed] == "2.386") [[7]] - list(widehat(mu)[trimmed] == "5.000") + list(widehat(mu)[MAP] == "3.472") [[8]] - list(widehat(mu)[trimmed] == "5.910") - - [[9]] - list(widehat(mu)[trimmed] == "6.547") - - [[10]] - list(widehat(mu)[MAP] == "5.02") - - [[11]] - list(widehat(mu)[MAP] == "5.75") - - [[12]] - list(widehat(mu)[MAP] == "6.40") + list(widehat(mu)[MAP] == "2.339") # centrality description works as expected - missing data @@ -80,43 +60,27 @@ Code select(df_na, -expression) Output - # A tibble: 16 x 14 - condition desire std.dev iqr conf.low conf.high min max skewness - - 1 HDHF 7.85 2.47 4 7.50 8.20 0 10 -1.13 - 2 HDLF 6.74 3.11 5 6.22 7.26 0 10 -0.740 - 3 LDHF 7.38 2.52 3.5 7.01 7.88 0.5 10 -0.947 - 4 LDLF 5.72 2.71 4 5.34 6.10 0 10 -0.132 - 5 HDHF 8.75 NA 4 8 9.88 0 10 -1.13 - 6 HDLF 8 NA 5 6 8.5 0 10 -0.740 - 7 LDHF 8 NA 3.5 7.25 8.5 0.5 10 -0.947 - 8 LDLF 6 NA 4 5 6.25 0 10 -0.132 - 9 HDHF 8.47 2.47 4 7.73 8.67 0 10 -1.13 - 10 HDLF 7.32 3.11 5 6.35 7.77 0 10 -0.740 - 11 LDHF 7.88 2.52 3.5 7.12 8.12 0.5 10 -0.947 - 12 LDLF 5.72 2.71 4 5.27 6.35 0 10 -0.132 - 13 HDHF 9.98 NA 4 9.97 9.99 0 10 -1.13 - 14 HDLF 9.73 NA 5 9.10 9.92 0 10 -0.740 - 15 LDHF 9.86 NA 3.5 9.82 9.97 0.5 10 -0.947 - 16 LDLF 5.99 NA 4 5.59 6.25 0 10 -0.132 - kurtosis n.obs missing.obs n.expression mad - - 1 0.486 92 0 "HDHF\n(n = 92)" NA - 2 -0.663 91 0 "HDLF\n(n = 91)" NA - 3 0.160 91 0 "LDHF\n(n = 91)" NA - 4 -0.761 93 0 "LDLF\n(n = 93)" NA - 5 0.486 92 0 "HDHF\n(n = 92)" 1.85 - 6 -0.663 91 0 "HDLF\n(n = 91)" 2.97 - 7 0.160 91 0 "LDHF\n(n = 91)" 2.97 - 8 -0.761 93 0 "LDLF\n(n = 93)" 2.97 - 9 0.486 92 0 "HDHF\n(n = 92)" NA - 10 -0.663 91 0 "HDLF\n(n = 91)" NA - 11 0.160 91 0 "LDHF\n(n = 91)" NA - 12 -0.761 93 0 "LDLF\n(n = 93)" NA - 13 0.486 92 0 "HDHF\n(n = 92)" NA - 14 -0.663 91 0 "HDLF\n(n = 91)" NA - 15 0.160 91 0 "LDHF\n(n = 91)" NA - 16 -0.761 93 0 "LDLF\n(n = 93)" NA + # A tibble: 8 x 14 + gender desire std.dev iqr conf.low conf.high min max skewness kurtosis + + 1 Female 7.07 2.87 5 6.77 7.36 0 10 -0.733 -0.550 + 2 Male 6.53 2.73 4 6.20 6.98 0 10 -0.628 -0.447 + 3 Female 8 NA 5 7 8.5 0 10 -0.733 -0.550 + 4 Male 7 NA 4 6 8 0 10 -0.628 -0.447 + 5 Female 7.63 2.87 5 7.05 7.69 0 10 -0.733 -0.550 + 6 Male 6.86 2.73 4 6.27 7.27 0 10 -0.628 -0.447 + 7 Female 10 NA 5 9.99 10 0 10 -0.733 -0.550 + 8 Male 7.89 NA 4 7.57 8.91 0 10 -0.628 -0.447 + n.obs missing.obs n.expression mad + + 1 247 0 "Female\n(n = 247)" NA + 2 116 0 "Male\n(n = 116)" NA + 3 247 0 "Female\n(n = 247)" 2.97 + 4 116 0 "Male\n(n = 116)" 2.97 + 5 247 0 "Female\n(n = 247)" NA + 6 116 0 "Male\n(n = 116)" NA + 7 247 0 "Female\n(n = 247)" NA + 8 116 0 "Male\n(n = 116)" NA --- @@ -124,52 +88,28 @@ df_na[["expression"]] Output [[1]] - list(widehat(mu)[mean] == "7.85") + list(widehat(mu)[mean] == "7.073") [[2]] - list(widehat(mu)[mean] == "6.74") + list(widehat(mu)[mean] == "6.534") [[3]] - list(widehat(mu)[mean] == "7.38") + list(widehat(mu)[median] == "8.000") [[4]] - list(widehat(mu)[mean] == "5.72") + list(widehat(mu)[median] == "7.000") [[5]] - list(widehat(mu)[median] == "8.750") + list(widehat(mu)[trimmed] == "7.631") [[6]] - list(widehat(mu)[median] == "8.000") + list(widehat(mu)[trimmed] == "6.857") [[7]] - list(widehat(mu)[median] == "8.000") + list(widehat(mu)[MAP] == "10.000") [[8]] - list(widehat(mu)[median] == "6.000") - - [[9]] - list(widehat(mu)[trimmed] == "8.473") - - [[10]] - list(widehat(mu)[trimmed] == "7.318") - - [[11]] - list(widehat(mu)[trimmed] == "7.882") - - [[12]] - list(widehat(mu)[trimmed] == "5.719") - - [[13]] - list(widehat(mu)[MAP] == "9.98") - - [[14]] - list(widehat(mu)[MAP] == "9.73") - - [[15]] - list(widehat(mu)[MAP] == "9.86") - - [[16]] - list(widehat(mu)[MAP] == "5.99") + list(widehat(mu)[MAP] == "7.889") # centrality description works when variable is named `variable` diff --git a/tests/testthat/_snaps/meta-random-parametric.md b/tests/testthat/_snaps/meta-random-parametric.md index ae883702..9f091c0c 100644 --- a/tests/testthat/_snaps/meta-random-parametric.md +++ b/tests/testthat/_snaps/meta-random-parametric.md @@ -25,3 +25,11 @@ "16") +--- + + Code + meta_analysis(mtcars) + Condition + Error: + ! Cannot find the object/variable ('estimate') specified for the 'yi' argument. + diff --git a/tests/testthat/_snaps/one-sample.md b/tests/testthat/_snaps/one-sample.md index d3e59728..300990b7 100644 --- a/tests/testthat/_snaps/one-sample.md +++ b/tests/testthat/_snaps/one-sample.md @@ -1,154 +1,193 @@ -# one_sample_test parametric works +# one-sample-test without missing data: type=bayes, conf.level=0.95, effsize.type=g Code - select(df1, -expression) + names(res) + Output + [1] "term" "effectsize" "estimate" + [4] "conf.level" "conf.low" "conf.high" + [7] "pd" "prior.distribution" "prior.location" + [10] "prior.scale" "bf10" "method" + [13] "conf.method" "log_e_bf10" "n.obs" + [16] "expression" + +--- + + Code + res$bf10[[1L]] + Output + [1] 1.199152e+15 + +# one-sample-test without missing data: type=bayes, conf.level=0.9, effsize.type=d + + Code + names(res) + Output + [1] "term" "effectsize" "estimate" + [4] "conf.level" "conf.low" "conf.high" + [7] "pd" "prior.distribution" "prior.location" + [10] "prior.scale" "bf10" "method" + [13] "conf.method" "log_e_bf10" "n.obs" + [16] "expression" + +--- + + Code + res$bf10[[1L]] + Output + [1] 1.199152e+15 + +# one-sample-test without missing data: type=parametric, conf.level=0.95, effsize.type=g + + Code + select(res, -expression) Output # A tibble: 1 x 14 - mu statistic df.error p.value method alternative effectsize - - 1 120 -2.67 78 0.00910 One Sample t-test two.sided Hedges' g + mu statistic df.error p.value method alternative effectsize + + 1 5 11.1 82 4.70e-18 One Sample t-test two.sided Hedges' g estimate conf.level conf.low conf.high conf.method conf.distribution n.obs - 1 -0.298 0.95 -0.520 -0.0738 ncp t 79 + 1 1.21 0.95 0.925 1.49 ncp t 83 --- Code - df1[["expression"]] + res[["expression"]] Output [[1]] - list(italic("t")["Student"] * "(" * 78 * ")" == "-2.67496", italic(p) == - "0.00910", widehat(italic("g"))["Hedges"] == "-0.29805", - CI["95%"] ~ "[" * "-0.52046", "-0.07382" * "]", italic("n")["obs"] == - "79") + list(italic("t")["Student"] * "(" * 82 * ")" == "11.1235", italic(p) == + "4.6953e-18", widehat(italic("g"))["Hedges"] == "1.2098", + CI["95%"] ~ "[" * "0.9254", "1.4897" * "]", italic("n")["obs"] == + "83") ---- +# one-sample-test without missing data: type=parametric, conf.level=0.9, effsize.type=d Code - select(df2, -expression) + select(res, -expression) Output # A tibble: 1 x 14 - mu statistic df.error p.value method alternative effectsize - - 1 120 -2.67 78 0.00910 One Sample t-test two.sided Cohen's d + mu statistic df.error p.value method alternative effectsize + + 1 5 11.1 82 4.70e-18 One Sample t-test two.sided Cohen's d estimate conf.level conf.low conf.high conf.method conf.distribution n.obs - 1 -0.301 0.9 -0.489 -0.111 ncp t 79 + 1 1.22 0.9 0.979 1.46 ncp t 83 --- Code - df2[["expression"]] + res[["expression"]] Output [[1]] - list(italic("t")["Student"] * "(" * 78 * ")" == "-2.6750", italic(p) == - "0.0091", widehat(italic("d"))["Cohen"] == "-0.3010", CI["90%"] ~ - "[" * "-0.4893", "-0.1108" * "]", italic("n")["obs"] == "79") + list(italic("t")["Student"] * "(" * 82 * ")" == "11.1235", italic(p) == + "4.6953e-18", widehat(italic("d"))["Cohen"] == "1.2210", + CI["90%"] ~ "[" * "0.9792", "1.4572" * "]", italic("n")["obs"] == + "83") -# one_sample_test non-parametric works +# one-sample-test without missing data: type=nonparametric, conf.level=0.95, effsize.type=g Code - select(df1, -expression) + select(res, -expression) Output # A tibble: 1 x 11 - statistic p.value method alternative effectsize - - 1 754. 0.323 Wilcoxon signed rank test two.sided r (rank biserial) + statistic p.value method alternative effectsize + + 1 3338. 4.43e-13 Wilcoxon signed rank test two.sided r (rank biserial) estimate conf.level conf.low conf.high conf.method n.obs - 1 -0.149 0.95 -0.416 0.143 normal 60 + 1 0.915 0.95 0.865 0.948 normal 83 --- Code - df1[["expression"]] + res[["expression"]] Output [[1]] - list(italic("V")["Wilcoxon"] == "753.5000", italic(p) == "0.3227", - widehat(italic("r"))["biserial"]^"rank" == "-0.1486", CI["95%"] ~ - "[" * "-0.4162", "0.1427" * "]", italic("n")["obs"] == - "60") + list(italic("V")["Wilcoxon"] == "3338.5000", italic(p) == "4.4279e-13", + widehat(italic("r"))["biserial"]^"rank" == "0.9154", CI["95%"] ~ + "[" * "0.8648", "0.9476" * "]", italic("n")["obs"] == + "83") ---- +# one-sample-test without missing data: type=nonparametric, conf.level=0.9, effsize.type=d Code - select(df2, -expression) + select(res, -expression) Output # A tibble: 1 x 11 - statistic p.value method alternative effectsize - - 1 262 0.0000125 Wilcoxon signed rank test two.sided r (rank biserial) + statistic p.value method alternative effectsize + + 1 3338. 4.43e-13 Wilcoxon signed rank test two.sided r (rank biserial) estimate conf.level conf.low conf.high conf.method n.obs - 1 -0.672 0.95 -0.806 -0.472 normal 56 + 1 0.915 0.9 0.874 0.943 normal 83 --- Code - df2[["expression"]] + res[["expression"]] Output [[1]] - list(italic("V")["Wilcoxon"] == "262.0000", italic(p) == "1.2527e-05", - widehat(italic("r"))["biserial"]^"rank" == "-0.6717", CI["95%"] ~ - "[" * "-0.8058", "-0.4720" * "]", italic("n")["obs"] == - "56") + list(italic("V")["Wilcoxon"] == "3338.5000", italic(p) == "4.4279e-13", + widehat(italic("r"))["biserial"]^"rank" == "0.9154", CI["90%"] ~ + "[" * "0.8745", "0.9433" * "]", italic("n")["obs"] == + "83") -# one_sample_test robust works +# one-sample-test without missing data: type=robust, conf.level=0.95, effsize.type=g Code - select(df1, -expression) + select(res, -expression) Output # A tibble: 1 x 9 statistic p.value n.obs method effectsize - 1 0.787 0.455 11 Bootstrap-t method for one-sample test Trimmed mean + 1 9.70 0 83 Bootstrap-t method for one-sample test Trimmed mean estimate conf.level conf.low conf.high - 1 9 0.9 6.55 11.5 + 1 10.5 0.95 9.33 11.6 --- Code - df1[["expression"]] + res[["expression"]] Output [[1]] - list(italic("t")["bootstrapped"] == "0.7866", italic(p) == "0.4550", - widehat(mu)["trimmed"] == "9.0000", CI["90%"] ~ "[" * "6.5487", - "11.4513" * "]", italic("n")["obs"] == "11") + list(italic("t")["bootstrapped"] == "9.7023", italic(p) == "0.0000", + widehat(mu)["trimmed"] == "10.4824", CI["95%"] ~ "[" * "9.3288", + "11.6359" * "]", italic("n")["obs"] == "83") ---- +# one-sample-test without missing data: type=robust, conf.level=0.9, effsize.type=d Code - select(df2, -expression) + select(res, -expression) Output # A tibble: 1 x 9 statistic p.value n.obs method effectsize - 1 -3.81 0.04 56 Bootstrap-t method for one-sample test Trimmed mean + 1 9.70 0 83 Bootstrap-t method for one-sample test Trimmed mean estimate conf.level conf.low conf.high - 1 0.0390 0.99 -0.0669 0.145 + 1 10.5 0.9 9.51 11.5 --- Code - df2[["expression"]] + res[["expression"]] Output [[1]] - list(italic("t")["bootstrapped"] == "-3.8075", italic(p) == "0.0400", - widehat(mu)["trimmed"] == "0.0390", CI["99%"] ~ "[" * "-0.0669", - "0.1448" * "]", italic("n")["obs"] == "56") + list(italic("t")["bootstrapped"] == "9.7023", italic(p) == "0.0000", + widehat(mu)["trimmed"] == "10.4824", CI["90%"] ~ "[" * "9.5064", + "11.4583" * "]", italic("n")["obs"] == "83") -# one_sample_test bayesian works +# one-sample-test with missing data: type=bayes, conf.level=0.95, effsize.type=g Code - names(df_results) + names(res) Output [1] "term" "effectsize" "estimate" [4] "conf.level" "conf.low" "conf.high" @@ -160,22 +199,172 @@ --- Code - df1[["expression"]] + res$bf10[[1L]] + Output + [1] 0.1500561 + +# one-sample-test with missing data: type=bayes, conf.level=0.9, effsize.type=d + + Code + names(res) + Output + [1] "term" "effectsize" "estimate" + [4] "conf.level" "conf.low" "conf.high" + [7] "pd" "prior.distribution" "prior.location" + [10] "prior.scale" "bf10" "method" + [13] "conf.method" "log_e_bf10" "n.obs" + [16] "expression" + +--- + + Code + res$bf10[[1L]] + Output + [1] 0.1500561 + +# one-sample-test with missing data: type=parametric, conf.level=0.95, effsize.type=g + + Code + select(res, -expression) + Output + # A tibble: 1 x 14 + mu statistic df.error p.value method alternative effectsize + + 1 0.25 0.242 55 0.810 One Sample t-test two.sided Hedges' g + estimate conf.level conf.low conf.high conf.method conf.distribution n.obs + + 1 0.0319 0.95 -0.227 0.290 ncp t 56 + +--- + + Code + res[["expression"]] + Output + [[1]] + list(italic("t")["Student"] * "(" * 55 * ")" == "0.2420", italic(p) == + "0.8096", widehat(italic("g"))["Hedges"] == "0.0319", CI["95%"] ~ + "[" * "-0.2266", "0.2901" * "]", italic("n")["obs"] == "56") + + +# one-sample-test with missing data: type=parametric, conf.level=0.9, effsize.type=d + + Code + select(res, -expression) + Output + # A tibble: 1 x 14 + mu statistic df.error p.value method alternative effectsize + + 1 0.25 0.242 55 0.810 One Sample t-test two.sided Cohen's d + estimate conf.level conf.low conf.high conf.method conf.distribution n.obs + + 1 0.0323 0.9 -0.188 0.252 ncp t 56 + +--- + + Code + res[["expression"]] + Output + [[1]] + list(italic("t")["Student"] * "(" * 55 * ")" == "0.2420", italic(p) == + "0.8096", widehat(italic("d"))["Cohen"] == "0.0323", CI["90%"] ~ + "[" * "-0.1877", "0.2521" * "]", italic("n")["obs"] == "56") + + +# one-sample-test with missing data: type=nonparametric, conf.level=0.95, effsize.type=g + + Code + select(res, -expression) + Output + # A tibble: 1 x 11 + statistic p.value method alternative effectsize + + 1 262 0.0000125 Wilcoxon signed rank test two.sided r (rank biserial) + estimate conf.level conf.low conf.high conf.method n.obs + + 1 -0.672 0.95 -0.806 -0.472 normal 56 + +--- + + Code + res[["expression"]] + Output + [[1]] + list(italic("V")["Wilcoxon"] == "262.0000", italic(p) == "1.2527e-05", + widehat(italic("r"))["biserial"]^"rank" == "-0.6717", CI["95%"] ~ + "[" * "-0.8058", "-0.4720" * "]", italic("n")["obs"] == + "56") + + +# one-sample-test with missing data: type=nonparametric, conf.level=0.9, effsize.type=d + + Code + select(res, -expression) + Output + # A tibble: 1 x 11 + statistic p.value method alternative effectsize + + 1 262 0.0000125 Wilcoxon signed rank test two.sided r (rank biserial) + estimate conf.level conf.low conf.high conf.method n.obs + + 1 -0.672 0.9 -0.788 -0.509 normal 56 + +--- + + Code + res[["expression"]] Output [[1]] - list(log[e] * (BF["01"]) == "-47.84", widehat(delta)["difference"]^"posterior" == - "-1.76", CI["90%"]^ETI ~ "[" * "-1.99", "-1.51" * "]", italic("r")["Cauchy"]^"JZS" == - "0.99") + list(italic("V")["Wilcoxon"] == "262.0000", italic(p) == "1.2527e-05", + widehat(italic("r"))["biserial"]^"rank" == "-0.6717", CI["90%"] ~ + "[" * "-0.7881", "-0.5088" * "]", italic("n")["obs"] == + "56") +# one-sample-test with missing data: type=robust, conf.level=0.95, effsize.type=g + + Code + select(res, -expression) + Output + # A tibble: 1 x 9 + statistic p.value n.obs method effectsize + + 1 -13.2 0.005 56 Bootstrap-t method for one-sample test Trimmed mean + estimate conf.level conf.low conf.high + + 1 0.0390 0.95 -0.0132 0.0911 + +--- + + Code + res[["expression"]] + Output + [[1]] + list(italic("t")["bootstrapped"] == "-13.1637", italic(p) == + "0.0050", widehat(mu)["trimmed"] == "0.0390", CI["95%"] ~ + "[" * "-0.0132", "0.0911" * "]", italic("n")["obs"] == "56") + + +# one-sample-test with missing data: type=robust, conf.level=0.9, effsize.type=d + + Code + select(res, -expression) + Output + # A tibble: 1 x 9 + statistic p.value n.obs method effectsize + + 1 -13.2 0.005 56 Bootstrap-t method for one-sample test Trimmed mean + estimate conf.level conf.low conf.high + + 1 0.0390 0.9 0.00419 0.0737 + --- Code - df2[["expression"]] + res[["expression"]] Output [[1]] - list(log[e] * (BF["01"]) == "2.125", widehat(delta)["difference"]^"posterior" == - "0.018", CI["95%"]^ETI ~ "[" * "-0.234", "0.274" * "]", italic("r")["Cauchy"]^"JZS" == - "0.900") + list(italic("t")["bootstrapped"] == "-13.1637", italic(p) == + "0.0050", widehat(mu)["trimmed"] == "0.0390", CI["90%"] ~ + "[" * "0.0042", "0.0737" * "]", italic("n")["obs"] == "56") diff --git a/tests/testthat/test-centrality-description.R b/tests/testthat/test-centrality-description.R index 98231b18..73d4d82c 100644 --- a/tests/testthat/test-centrality-description.R +++ b/tests/testthat/test-centrality-description.R @@ -1,17 +1,14 @@ -skip_if_not_installed("boot") -skip_if_not(getRversion() >= "4.4.0") - test_that( desc = "centrality description works as expected - no missing data", code = { set.seed(123) df <- purrr::pmap_dfr( .l = list( - data = list(iris), - x = alist(Species), - y = alist(Sepal.Length), + data = list(mtcars), + x = alist(am), + y = alist(wt), type = list("p", "np", "r", "b"), - digits = list(2L, 3L, 3L, 2L), + digits = 3L, conf.level = list(0.89, 0.99, 0.90, 0.50) ), .f = centrality_description @@ -33,10 +30,10 @@ test_that( df_na <- purrr::pmap_dfr( .l = list( data = list(bugs_long), - x = alist(condition), + x = alist(gender), y = alist(desire), type = list("p", "np", "r", "b"), - digits = list(2L, 3L, 3L, 2L), + digits = 3L, conf.level = list(0.89, 0.99, 0.90, 0.50) ), .f = centrality_description diff --git a/tests/testthat/test-meta-random-bayes.R b/tests/testthat/test-meta-random-bayes.R index 5ac1e3f8..385f09ed 100644 --- a/tests/testthat/test-meta-random-bayes.R +++ b/tests/testthat/test-meta-random-bayes.R @@ -2,7 +2,6 @@ test_that( desc = "meta_analysis works - bayesian", code = { skip_if_not_installed("metaBMA") - skip_if_not(getRversion() >= "4.4.0") set.seed(123) df <- meta_analysis( diff --git a/tests/testthat/test-meta-random-parametric.R b/tests/testthat/test-meta-random-parametric.R index 0e7b5183..2e0875b3 100644 --- a/tests/testthat/test-meta-random-parametric.R +++ b/tests/testthat/test-meta-random-parametric.R @@ -4,12 +4,12 @@ test_that( skip_if_not_installed("metafor") set.seed(123) - df <- suppressWarnings(meta_analysis(data_meta)) + df <- meta_analysis(data_meta) set.seed(123) expect_snapshot(select(df, -expression)) expect_snapshot(df[["expression"]]) - expect_error(suppressWarnings(meta_analysis(mtcars))) + expect_snapshot(meta_analysis(mtcars), error = TRUE) } ) diff --git a/tests/testthat/test-one-sample.R b/tests/testthat/test-one-sample.R index 7fdc6a94..bf4aca9c 100644 --- a/tests/testthat/test-one-sample.R +++ b/tests/testthat/test-one-sample.R @@ -1,140 +1,40 @@ -test_that( - desc = "one_sample_test parametric works", - code = { - set.seed(123) - df1 <- one_sample_test( - data = sample_frac(movies_long, 0.05), - x = length, - test.value = 120, - type = "p", - digits = 5 - ) - - set.seed(123) - df2 <- suppressWarnings( - one_sample_test( - data = sample_frac(movies_long, 0.05), - x = length, - test.value = 120, - type = "p", - effsize.type = "d", - digits = 4L, - conf.level = 0.90 +run_one_sample_tests_with_parameters <- function(title, x, test.value) { + cases_data <- tidyr::expand_grid( + type = c("bayes", "parametric", "nonparametric", "robust"), + conf.level = c(0.95, 0.90) + ) %>% + dplyr::mutate( + effsize.type = rep_len(c("g", "d"), length.out = nrow(.)) # relevant only for parametric + ) + + patrick::with_parameters_test_that( + title, + { + set.seed(123L) + res <- one_sample_test( + data = msleep, + x = {{ x }}, + type = type, + conf.level = conf.level, + effsize.type = effsize.type, + conf.method = conf.method, + test.value = test.value, + digits = 4L ) - ) - - set.seed(123) - expect_snapshot(select(df1, -expression)) - expect_snapshot(df1[["expression"]]) - - expect_snapshot(select(df2, -expression)) - expect_snapshot(df2[["expression"]]) - } -) - -test_that( - desc = "one_sample_test non-parametric works", - code = { - set.seed(123) - df1 <- suppressWarnings(one_sample_test( - data = ToothGrowth, - x = len, - test.value = 20, - type = "np", - digits = 4L - )) - - set.seed(123) - df2 <- one_sample_test( - data = msleep, - x = brainwt, - test.value = 0.25, - type = "np", - digits = 4L - ) - - set.seed(123) - expect_snapshot(select(df1, -expression)) - expect_snapshot(df1[["expression"]]) - - expect_snapshot(select(df2, -expression)) - expect_snapshot(df2[["expression"]]) - } -) - -test_that( - desc = "one_sample_test robust works", - code = { - set.seed(123) - df1 <- one_sample_test( - data = anscombe, - x = x1, - test.value = 8, - type = "r", - digits = 4L, - conf.level = 0.90 - ) - - set.seed(123) - df2 <- one_sample_test( - data = msleep, - x = brainwt, - test.value = 0.1, - type = "r", - digits = 4L, - conf.level = 0.99 - ) - - set.seed(123) - expect_snapshot(select(df1, -expression)) - expect_snapshot(df1[["expression"]]) - - expect_snapshot(select(df2, -expression)) - expect_snapshot(df2[["expression"]]) - } -) - -test_that( - desc = "one_sample_test bayesian works", - code = { - set.seed(123) - df_results <- one_sample_test( - type = "bayes", - data = iris, - x = Petal.Length, - y = NULL, - test.value = 5.5, - bf.prior = 0.99 - ) - - expect_equal(df_results$bf10[[1]], 5.958171e+20, tolerance = 0.001) - expect_snapshot(names(df_results)) - - set.seed(123) - df1 <- one_sample_test( - type = "bayes", - data = iris, - x = Petal.Length, - y = NULL, - test.value = 5.5, - bf.prior = 0.99, - conf.level = 0.90 - ) - - expect_snapshot(df1[["expression"]]) - - set.seed(123) - df2 <- one_sample_test( - type = "bayes", - data = msleep, - x = brainwt, - y = NULL, - test.value = 0.25, - bf.prior = 0.9, - digits = 3L, - conf.method = "eti" - ) - expect_snapshot(df2[["expression"]]) - } -) + # Bayesian estimation results are too platform-sensitive, so don't + # snapshot them; only recording Bayes Factors is enough + if (type == "bayes") { + expect_snapshot(names(res)) + expect_snapshot(res$bf10[[1L]]) + } else { + expect_snapshot(select(res, -expression)) + expect_snapshot(res[["expression"]]) + } + }, + .cases = cases_data + ) +} + +run_one_sample_tests_with_parameters("one-sample-test without missing data: ", sleep_total, 5.0) +run_one_sample_tests_with_parameters("one-sample-test with missing data: ", brainwt, 0.25) diff --git a/tests/testthat/test-one-two-sample-dataframes.R b/tests/testthat/test-one-two-sample-dataframes.R index 351d8208..fdc13107 100644 --- a/tests/testthat/test-one-two-sample-dataframes.R +++ b/tests/testthat/test-one-two-sample-dataframes.R @@ -1,8 +1,6 @@ test_that( desc = " parametric t-tests", code = { - skip_if_not(getRversion() >= "4.4.0") - # one-sample t-test (with NAs) --------- set.seed(123) diff --git a/tests/testthat/test-oneway-anova-bayes.R b/tests/testthat/test-oneway-anova-bayes.R index 8fb5bc80..098c4fdf 100644 --- a/tests/testthat/test-oneway-anova-bayes.R +++ b/tests/testthat/test-oneway-anova-bayes.R @@ -1,8 +1,6 @@ # don't test data frames because the values vary across platforms, even with the # same seed; for the same reason, don't change number of digits -skip_if_not(getRversion() >= "4.4.0") - # between-subjects ------------------------------ skip_if_not_installed("rstantools") diff --git a/tests/testthat/test-oneway-anova-nonparametric.R b/tests/testthat/test-oneway-anova-nonparametric.R index 962d2a08..88c9ce6d 100644 --- a/tests/testthat/test-oneway-anova-nonparametric.R +++ b/tests/testthat/test-oneway-anova-nonparametric.R @@ -95,6 +95,6 @@ test_that( paired = TRUE ) - expect_equal(expr1, expr2, ignore_attr = TRUE) + expect_identical(expr1, expr2) } ) diff --git a/tests/testthat/test-oneway-anova-parametric.R b/tests/testthat/test-oneway-anova-parametric.R index ac28319e..74bb131d 100644 --- a/tests/testthat/test-oneway-anova-parametric.R +++ b/tests/testthat/test-oneway-anova-parametric.R @@ -1,9 +1,6 @@ test_that( desc = "parametric anova subtitles work (without NAs)", code = { - # parametric anova subtitles (without NAs) ------------------------------ - - # statsExpression output set.seed(123) df <- oneway_anova( data = mtcars, @@ -18,7 +15,7 @@ test_that( expect_snapshot(select(df, -expression)) expect_snapshot(df[["expression"]]) - # statsExpression output + set.seed(123) df1 <- oneway_anova( data = mtcars, @@ -38,9 +35,6 @@ test_that( test_that( desc = "parametric anova subtitles with partial omega-squared", code = { - # parametric anova subtitles (partial omega) ------------------------------ - - # statsExpression output set.seed(123) df1 <- oneway_anova( data = msleep, @@ -59,9 +53,6 @@ test_that( test_that( desc = "paired parametric anova subtitles work (without NAs)", code = { - # parametric repeated anova subtitles (basic) ---------------------------- - - # statsExpression output set.seed(123) df1 <- oneway_anova( data = iris_long, @@ -85,7 +76,6 @@ test_that( code = { df <- data_with_subid - set.seed(123) expr1 <- oneway_anova( data = df, @@ -95,7 +85,6 @@ test_that( paired = TRUE ) - set.seed(123) expr2 <- oneway_anova( data = arrange(df, id), @@ -104,6 +93,6 @@ test_that( paired = TRUE ) - expect_equal(expr1, expr2, ignore_attr = TRUE) + expect_identical(expr1, expr2) } ) diff --git a/tests/testthat/test-two-sample-bayes.R b/tests/testthat/test-two-sample-bayes.R index e329e116..6c976c5f 100644 --- a/tests/testthat/test-two-sample-bayes.R +++ b/tests/testthat/test-two-sample-bayes.R @@ -70,6 +70,6 @@ test_that( paired = TRUE ) - expect_equal(expr1, expr2, ignore_attr = TRUE) + expect_identical(expr1, expr2) } ) diff --git a/tests/testthat/test-two-sample-nonparametric.R b/tests/testthat/test-two-sample-nonparametric.R index 0f58e791..96582710 100644 --- a/tests/testthat/test-two-sample-nonparametric.R +++ b/tests/testthat/test-two-sample-nonparametric.R @@ -65,6 +65,6 @@ test_that( paired = TRUE ) - expect_equal(expr1, expr2, ignore_attr = TRUE) + expect_identical(expr1, expr2) } ) diff --git a/tests/testthat/test-two-sample-parametric.R b/tests/testthat/test-two-sample-parametric.R index 4c808555..0dcf5388 100644 --- a/tests/testthat/test-two-sample-parametric.R +++ b/tests/testthat/test-two-sample-parametric.R @@ -104,6 +104,6 @@ test_that( paired = TRUE ) - expect_equal(expr1, expr2, ignore_attr = TRUE) + expect_identical(expr1, expr2) } ) diff --git a/tests/testthat/test-two-sample-robust.R b/tests/testthat/test-two-sample-robust.R index 9dfec247..11d49984 100644 --- a/tests/testthat/test-two-sample-robust.R +++ b/tests/testthat/test-two-sample-robust.R @@ -111,6 +111,6 @@ test_that( paired = TRUE ) - expect_equal(expr1, expr2, ignore_attr = TRUE) + expect_identical(expr1, expr2) } ) diff --git a/vignettes/setup.R b/vignettes/setup.R index 6926f9d0..61a424ed 100644 --- a/vignettes/setup.R +++ b/vignettes/setup.R @@ -11,5 +11,7 @@ knitr::opts_chunk$set( library(dplyr) library(statsExpressions) +options(lifecycle_verbosity = "warning") + # for reproducibility set.seed(123) diff --git a/vignettes/statsExpressions.Rmd b/vignettes/statsExpressions.Rmd index 80b34601..33877047 100644 --- a/vignettes/statsExpressions.Rmd +++ b/vignettes/statsExpressions.Rmd @@ -150,7 +150,7 @@ statistical reporting for both Bayesian [@van2020jasp] and Frequentist #| echo = FALSE, #| fig.cap = "The templates used in `{statsExpressions}` to display statistical details in a #| plot." -knitr::include_graphics("../man/figures/stats_reporting_format.png") +knitr::include_graphics("stats_reporting_format.png") ``` This expression be easily displayed in a plot (Figure 2). Displaying statistical diff --git a/vignettes/stats_reporting_format.png b/vignettes/stats_reporting_format.png new file mode 100644 index 00000000..196ad9a6 Binary files /dev/null and b/vignettes/stats_reporting_format.png differ diff --git a/vignettes/web_only/stats_details.md b/vignettes/web_only/stats_details.md new file mode 100644 index 00000000..f22def4e --- /dev/null +++ b/vignettes/web_only/stats_details.md @@ -0,0 +1,299 @@ +--- +title: "Test and effect size details" +output: + rmarkdown::html_vignette: + toc: true + toc_depth: 4 + keep_md: true +vignette: > + %\VignetteIndexEntry{Test and effect size details} + %\VignetteEngine{knitr::rmarkdown} + %\VignetteEncoding{UTF-8} +--- + + + +This vignette can be cited as: + + +``` +To cite package 'statsExpressions' in publications use: + + Patil, I., (2021). statsExpressions: R Package for Tidy Dataframes and Expressions with Statistical Details. + Journal of Open Source Software, 6(61), 3236, https://doi.org/10.21105/joss.03236 + +A BibTeX entry for LaTeX users is + + @Article{, + doi = {10.21105/joss.03236}, + url = {https://doi.org/10.21105/joss.03236}, + year = {2021}, + publisher = {{The Open Journal}}, + volume = {6}, + number = {61}, + pages = {3236}, + author = {Indrajeet Patil}, + title = {{statsExpressions: {R} Package for Tidy Dataframes and Expressions with Statistical Details}}, + journal = {{Journal of Open Source Software}}, + } +``` + +## Introduction + +Here a go-to summary about statistical test carried out and the returned effect +size for each function is provided. This should be useful if one needs to find +out more information about how an argument is resolved in the underlying package +or if one wishes to browse the source code. So, for example, if you want to know +more about how one-way (between-subjects) ANOVA, you can run +`?stats::oneway.test` in your R console. + +Abbreviations used: CI = Confidence Interval + +## Summary of functionality + + +**Summary of available analyses** + +| Test | Function | +| :------------------------- | :----------------------- | +| one-sample *t*-test | `one_sample_test()` | +| two-sample *t*-test | `two_sample_test()` | +| one-way ANOVA | `oneway_anova()` | +| correlation analysis | `corr_test()` | +| contingency table analysis | `contingency_table()` | +| meta-analysis | `meta_analysis()` | +| pairwise comparisons | `pairwise_comparisons()` | + +**Summary of details available for analyses** + +| Analysis | Hypothesis testing | Effect size estimation | +| :------------------------------ | :----------------- | :--------------------- | +| (one/two-sample) *t*-test | ✅ | ✅ | +| one-way ANOVA | ✅ | ✅ | +| correlation | ✅ | ✅ | +| (one/two-way) contingency table | ✅ | ✅ | +| random-effects meta-analysis | ✅ | ✅ | + +**Summary of supported statistical approaches** + +| Description | Parametric | Non-parametric | Robust | Bayesian | +| :------------------------------------------------ | :--------- | :------------- | :----- | :------- | +| Between group/condition comparisons | ✅ | ✅ | ✅ | ✅ | +| Within group/condition comparisons | ✅ | ✅ | ✅ | ✅ | +| Distribution of a numeric variable | ✅ | ✅ | ✅ | ✅ | +| Correlation between two variables | ✅ | ✅ | ✅ | ✅ | +| Association between categorical variables | ✅ | ✅ | ❌ | ✅ | +| Equal proportions for categorical variable levels | ✅ | ✅ | ❌ | ✅ | +| Random-effects meta-analysis | ✅ | ❌ | ✅ | ✅ | + +## Summary of tests and effect sizes + +Here a go-to summary about statistical test carried out and the returned effect +size for each function is provided. This should be useful if one needs to find +out more information about how an argument is resolved in the underlying package +or if one wishes to browse the source code. So, for example, if you want to know +more about how one-way (between-subjects) ANOVA, you can run +`?stats::oneway.test` in your R console. + +### `centrality_description()` + + +| Type | Measure | Function used | +| :------------- | :----------- | :------------------------------------ | +| Parametric | mean | `datawizard::describe_distribution()` | +| Non-parametric | median | `datawizard::describe_distribution()` | +| Robust | trimmed mean | `datawizard::describe_distribution()` | +| Bayesian | MAP | `datawizard::describe_distribution()` | + +### `oneway_anova()` + + +#### between-subjects + +**Hypothesis testing** + +| Type | No. of groups | Test | Function used | +| :------------- | :------------ | :---------------------------------------------- | :----------------------- | +| Parametric | > 2 | Fisher's or Welch's one-way ANOVA | `stats::oneway.test()` | +| Non-parametric | > 2 | Kruskal-Wallis one-way ANOVA | `stats::kruskal.test()` | +| Robust | > 2 | Heteroscedastic one-way ANOVA for trimmed means | `WRS2::t1way()` | +| Bayes Factor | > 2 | Fisher's ANOVA | `BayesFactor::anovaBF()` | + +**Effect size estimation** + +| Type | No. of groups | Effect size | CI available? | Function used | +| :------------- | :------------ | :----------------------------------------- | :------------ | :--------------------------------------------------------- | +| Parametric | > 2 | partial eta-squared, partial omega-squared | Yes | `effectsize::omega_squared()`, `effectsize::eta_squared()` | +| Non-parametric | > 2 | rank epsilon squared | Yes | `effectsize::rank_epsilon_squared()` | +| Robust | > 2 | Explanatory measure of effect size | Yes | `WRS2::t1way()` | +| Bayes Factor | > 2 | Bayesian R-squared | Yes | `performance::r2_bayes()` | + +#### within-subjects + +**Hypothesis testing** + +| Type | No. of groups | Test | Function used | +| :------------- | :------------ | :---------------------------------------------------------------- | :----------------------- | +| Parametric | > 2 | One-way repeated measures ANOVA | `afex::aov_ez()` | +| Non-parametric | > 2 | Friedman rank sum test | `stats::friedman.test()` | +| Robust | > 2 | Heteroscedastic one-way repeated measures ANOVA for trimmed means | `WRS2::rmanova()` | +| Bayes Factor | > 2 | One-way repeated measures ANOVA | `BayesFactor::anovaBF()` | + +**Effect size estimation** + +| Type | No. of groups | Effect size | CI available? | Function used | +| :------------- | :------------ | :-------------------------------------------------------------- | :------------ | :--------------------------------------------------------- | +| Parametric | > 2 | partial eta-squared, partial omega-squared | Yes | `effectsize::omega_squared()`, `effectsize::eta_squared()` | +| Non-parametric | > 2 | Kendall's coefficient of concordance | Yes | `effectsize::kendalls_w()` | +| Robust | > 2 | Algina-Keselman-Penfield robust standardized difference average | Yes | `WRS2::wmcpAKP()` | +| Bayes Factor | > 2 | Bayesian R-squared | Yes | `performance::r2_bayes()` | + +### `two_sample_test()` + + +#### between-subjects + +**Hypothesis testing** + +| Type | No. of groups | Test | Function used | +| :------------- | :------------ | :---------------------------- | :----------------------- | +| Parametric | 2 | Student's or Welch's *t*-test | `stats::t.test()` | +| Non-parametric | 2 | Mann-Whitney *U* test | `stats::wilcox.test()` | +| Robust | 2 | Yuen's test for trimmed means | `WRS2::yuen()` | +| Bayesian | 2 | Student's *t*-test | `BayesFactor::ttestBF()` | + +**Effect size estimation** + +| Type | No. of groups | Effect size | CI available? | Function used | +| :------------- | :------------ | :------------------------------------------------------ | :------------ | :------------------------------------------------- | +| Parametric | 2 | Cohen's *d*, Hedge's *g* | Yes | `effectsize::cohens_d()`, `effectsize::hedges_g()` | +| Non-parametric | 2 | *r* (rank-biserial correlation) | Yes | `effectsize::rank_biserial()` | +| Robust | 2 | Algina-Keselman-Penfield robust standardized difference | Yes | `WRS2::akp.effect()` | +| Bayesian | 2 | difference | Yes | `bayestestR::describe_posterior()` | + +#### within-subjects + +**Hypothesis testing** + +| Type | No. of groups | Test | Function used | +| :------------- | :------------ | :------------------------------------------------- | :----------------------- | +| Parametric | 2 | Student's *t*-test | `stats::t.test()` | +| Non-parametric | 2 | Wilcoxon signed-rank test | `stats::wilcox.test()` | +| Robust | 2 | Yuen's test on trimmed means for dependent samples | `WRS2::yuend()` | +| Bayesian | 2 | Student's *t*-test | `BayesFactor::ttestBF()` | + +**Effect size estimation** + +| Type | No. of groups | Effect size | CI available? | Function used | +| :------------- | :------------ | :------------------------------------------------------ | :------------ | :------------------------------------------------- | +| Parametric | 2 | Cohen's *d*, Hedge's *g* | Yes | `effectsize::cohens_d()`, `effectsize::hedges_g()` | +| Non-parametric | 2 | *r* (rank-biserial correlation) | Yes | `effectsize::rank_biserial()` | +| Robust | 2 | Algina-Keselman-Penfield robust standardized difference | Yes | `WRS2::wmcpAKP()` | +| Bayesian | 2 | difference | Yes | `bayestestR::describe_posterior()` | + +### `one_sample_test()` + + + +**Hypothesis testing** + +| Type | Test | Function used | +| :------------- | :--------------------------------------- | :----------------------- | +| Parametric | One-sample Student's *t*-test | `stats::t.test()` | +| Non-parametric | One-sample Wilcoxon test | `stats::wilcox.test()` | +| Robust | Bootstrap-*t* method for one-sample test | `WRS2::trimcibt()` | +| Bayesian | One-sample Student's *t*-test | `BayesFactor::ttestBF()` | + +**Effect size estimation** + +| Type | Effect size | CI available? | Function used | +| :------------- | :------------------------------ | :------------ | :------------------------------------------------- | +| Parametric | Cohen's *d*, Hedge's *g* | Yes | `effectsize::cohens_d()`, `effectsize::hedges_g()` | +| Non-parametric | *r* (rank-biserial correlation) | Yes | `effectsize::rank_biserial()` | +| Robust | trimmed mean | Yes | `WRS2::trimcibt()` | +| Bayes Factor | difference | Yes | `bayestestR::describe_posterior()` | + +### `corr_test()` + + +**Hypothesis testing** and **Effect size estimation** + +| Type | Test | CI available? | Function used | +| :------------- | :------------------------------------------- | :------------ | :--------------------------- | +| Parametric | Pearson's correlation coefficient | Yes | `correlation::correlation()` | +| Non-parametric | Spearman's rank correlation coefficient | Yes | `correlation::correlation()` | +| Robust | Winsorized Pearson's correlation coefficient | Yes | `correlation::correlation()` | +| Bayesian | Bayesian Pearson's correlation coefficient | Yes | `correlation::correlation()` | + +### `contingency_table()` + + +#### two-way table + +**Hypothesis testing** + +| Type | Design | Test | Function used | +| :------------------------ | :------- | :---------------------------------- | :---------------------------------- | +| Parametric/Non-parametric | Unpaired | Pearson's chi-squared test | `stats::chisq.test()` | +| Bayesian | Unpaired | Bayesian Pearson's chi-squared test | `BayesFactor::contingencyTableBF()` | +| Parametric/Non-parametric | Paired | McNemar's chi-squared test | `stats::mcnemar.test()` | +| Bayesian | Paired | No | No | + +**Effect size estimation** + +| Type | Design | Effect size | CI available? | Function used | +| :------------------------ | :------- | :----------- | :------------ | :------------------------ | +| Parametric/Non-parametric | Unpaired | Cramer's *V* | Yes | `effectsize::cramers_v()` | +| Bayesian | Unpaired | Cramer's *V* | Yes | `effectsize::cramers_v()` | +| Parametric/Non-parametric | Paired | Cohen's *g* | Yes | `effectsize::cohens_g()` | +| Bayesian | Paired | No | No | No | + +#### one-way table + +**Hypothesis testing** + +| Type | Test | Function used | +| :------------------------ | :---------------------------------------- | :-------------------- | +| Parametric/Non-parametric | Goodness of fit chi-squared test | `stats::chisq.test()` | +| Bayesian | Bayesian Goodness of fit chi-squared test | (custom) | + +**Effect size estimation** + +| Type | Effect size | CI available? | Function used | +| :------------------------ | :------------ | :------------ | :------------------------- | +| Parametric/Non-parametric | Pearson's *C* | Yes | `effectsize::pearsons_c()` | +| Bayesian | No | No | No | + +### `meta_analysis()` + + +**Hypothesis testing** and **Effect size estimation** + +| Type | Test | Effect size | CI available? | Function used | +| :--------- | :----------------------------------------------- | :---------- | :------------ | :----------------------- | +| Parametric | Meta-analysis via random-effects models | *beta* | Yes | `metafor::metafor()` | +| Robust | Meta-analysis via robust random-effects models | *beta* | Yes | `metaplus::metaplus()` | +| Bayes | Meta-analysis via Bayesian random-effects models | *beta* | Yes | `metaBMA::meta_random()` | + +## Effect size interpretation + +See `{effectsize}`'s interpretation functions to check different rules/conventions +to interpret effect sizes: + + + +## References + + - For parametric and non-parametric effect sizes: + + + - For robust effect sizes: + + + - For Bayesian posterior estimates: + + +## Suggestions + +If you find any bugs or have any suggestions/remarks, please file an issue on GitHub: +