Package Status Usage GitHub References
CRAN_Release_Badge Travis Build Status Daily downloads badge GitHub version Website
CRAN Checks AppVeyor Build Status Weekly downloads badge Forks Rdoc
minimal R version lifecycle Monthly downloads badge Github Issues vignettes
GitHub code size in bytes Coverage Status Total downloads badge Github Stars DOI
Licence Codecov test coverage HitCount Last-changedate GitHub last commit
status Covrpage Summary saythanks Project Status contributions welcome
Gitter chat

Introduction

statsExpressions provides statistical processing backend for the ggstatsplot package, which combines ggplot2 visualizations with expressions containing results from statistical tests. statsExpressions contains all functions needed to create these expressions.

Installation

To get the latest, stable CRAN release (0.1.1):

install.packages(pkgs = "statsExpressions")

You can get the development version of the package from GitHub (0.1.1.9000). To see what new changes (and bug fixes) have been made to the package since the last release on CRAN, you can check the detailed log of changes here: https://indrajeetpatil.github.io/statsExpressions/news/index.html

If you are in hurry and want to reduce the time of installation, prefer-

If time is not a constraint-

Citation

If you want to cite this package in a scientific journal or in any other context, run the following code in your R console:

citation("statsExpressions")

Documentation and Examples

To see the documentation relevant for the development version of the package, see the dedicated website for statsExpressions, which is updated after every new commit: https://indrajeetpatil.github.io/statsExpressions/.

Summary of types of statistical analyses

Currently, it supports only the most common types of statistical tests: parametric, nonparametric, robust, and bayesian versions of t-test/anova, correlation analyses, contingency table analysis, and regression analyses.

The table below summarizes all the different types of analyses currently supported in this package-

Description Parametric Non-parametric Robust Bayes Factor
Between group/condition comparisons Yes Yes Yes Yes
Within group/condition comparisons Yes Yes Yes Yes
Distribution of a numeric variable Yes Yes Yes Yes
Correlation between two variables Yes Yes Yes Yes
Association between categorical variables Yes NA NA Yes
Equal proportions for categorical variable levels Yes NA NA Yes

Statistical reporting

For all statistical test expressions, the default template abides by the APA gold standard for statistical reporting. For example, here are results from Yuen’s test for trimmed means (robust t-test):

Summary of statistical tests and effect sizes

Here is a summary table of all the statistical tests currently supported across various functions:

Functions Type Test Effect size 95% CI available?
expr_anova_parametric (2 groups) Parametric Student’s and Welch’s t-test Cohen’s d, Hedge’s g
expr_anova_parametric (> 2 groups) Parametric Fisher’s and Welch’s one-way ANOVA
expr_anova_nonparametric (2 groups) Non-parametric Mann-Whitney U-test r
expr_anova_nonparametric (> 2 groups) Non-parametric Kruskal-Wallis Rank Sum Test
expr_anova_robust (2 groups) Robust Yuen’s test for trimmed means
expr_anova_robust (> 2 groups) Robust Heteroscedastic one-way ANOVA for trimmed means
expr_anova_parametric (2 groups) Parametric Student’s t-test Cohen’s d, Hedge’s g
expr_anova_parametric (> 2 groups) Parametric Fisher’s one-way repeated measures ANOVA
expr_anova_nonparametric (2 groups) Non-parametric Wilcoxon signed-rank test r
expr_anova_nonparametric (> 2 groups) Non-parametric Friedman rank sum test
expr_anova_robust (2 groups) Robust Yuen’s test on trimmed means for dependent samples
expr_anova_robust (> 2 groups) Robust Heteroscedastic one-way repeated measures ANOVA for trimmed means
expr_contingency_tab (unpaired) Parametric Cramér’s V
expr_contingency_tab (paired) Parametric McNemar’s test Cohen’s g
expr_contingency_tab Parametric One-sample proportion test Cramér’s V
expr_corr_test Parametric Pearson’s r r
expr_corr_test Non-parametric
expr_corr_test Robust Percentage bend correlation r
expr_t_onesample Parametric One-sample t-test Cohen’s d, Hedge’s g
expr_t_onesample Non-parametric One-sample Wilcoxon signed rank test r
expr_t_onesample Robust One-sample percentile bootstrap robust estimator

Primary functions

A list of primary functions in this package can be found at the package website: https://indrajeetpatil.github.io/statsExpressions/reference/index.html

Following are few examples of how these functions can be used.

Example: Expressions for one-way ANOVA

Let’s say we want to check differences in weight of the vehicle based on number of cylinders in the engine and wish to carry out Welch’s ANOVA:

In case you change your mind and now want to carry out a robust ANOVA instead. Also, let’s use a different kind of a visualization:

Usage in ggstatsplot

Note that these functions were initially written to display results from statistical tests on ready-made ggplot2 plots implemented in ggstatsplot.

For detailed documentation, see the package website: https://indrajeetpatil.github.io/ggstatsplot/

Here is an example from ggstatsplot of what the plots look like when the expressions are displayed in the subtitle-

Code coverage

As the code stands right now, here is the code coverage for all primary functions involved: https://codecov.io/gh/IndrajeetPatil/statsExpressions/tree/master/R

Contributing

I’m happy to receive bug reports, suggestions, questions, and (most of all) contributions to fix problems and add features. I personally prefer using the GitHub issues system over trying to reach out to me in other ways (personal e-mail, Twitter, etc.). Pull Requests for contributions are encouraged.

Here are some simple ways in which you can contribute (in the increasing order of commitment):

  • Read and correct any inconsistencies in the documentation

  • Raise issues about bugs or wanted features

  • Review code

  • Add new functionality (in the form of new plotting functions or helpers for preparing subtitles)

Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.