MyNixOS website logo
Description

Boxplot and Significance Test for Two Groups.

Provides functions to create side-by-side boxplots for a continuous variable grouped by a two-level categorical variable, check normality assumptions using the Shapiro-Wilk test (Shapiro and Wilk (1965) <doi:10.2307/2333709>), and perform appropriate statistical tests such as the independent two-sample t-test (Student (1908) <doi:10.1093/biomet/6.1.1>) or the Mann–Whitney U test ( Mann–Whitney (1947) <doi:10.1214/aoms/1177730491>). Returns a publication-ready plot and test statistics including test statistic, degrees of freedom, and p-value.

boxTest

The boxTest package provides a simple way to compare two groups using boxplots and statistical tests. It automatically checks normality (via Shapiro–Wilk test) and then applies the appropriate test:

  • Independent 2-sample t-test (if both groups are normally distributed)
  • Mann–Whitney U test (if at least one group is non-normal)

It also generates a publication-ready boxplot with jittered points.


Installation

From GitHub (development version)

# install.packages("remotes")  # if not already installed
remotes::install_github("arka1985/boxTest")

From CRAN (once accepted)

install.packages("boxTest")

From tar.gz release

Download the .tar.gz file from Releases and install locally:

install.packages("path/to/boxTest_0.1.0.tar.gz", repos = NULL, type = "source")

Example

library(boxTest)

# Create a sample dataset: Male and Female BMI
df <- data.frame(
  gender = rep(c("Male", "Female"), each = 10),
  BMI = c(22, 24, 25, 23, 26, 28, 24, 23, 27, 25,
          21, 22, 23, 20, 24, 22, 21, 23, 22, 21)
)

# Compare BMI between Male and Female
res <- compare_two_groups(df, "BMI", "gender")

# Show the boxplot
print(res$plot)

# Normality test results
print(res$normality)

# Test summary (t-test or Mann–Whitney U)
print(res$test_summary)

Output

  • res$plot → A ggplot object showing the boxplot with jittered points
  • res$normality → Shapiro–Wilk test results for each group
  • res$test_summary → Test used, statistic, df (if applicable), and p-value

Authors

  • Arkaprabha Sau (Author & Maintainer)
  • Santanu Phadikar (Author)
  • Ishita Bhakta (Author)
Metadata

Version

0.1.0

License

Unknown

Platforms (76)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-freebsd
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64-windows
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-linux
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows