MyNixOS website logo
Description

Nonparametric Bootstrap Test with Pooled Resampling.

Addressing crucial research questions often necessitates a small sample size due to factors such as distinctive target populations, rarity of the event under study, time and cost constraints, ethical concerns, or group-level unit of analysis. Many readily available analytic methods, however, do not accommodate small sample sizes, and the choice of the best method can be unclear. The 'npboottprm' package enables the execution of nonparametric bootstrap tests with pooled resampling to help fill this gap. Grounded in the statistical methods for small sample size studies detailed in Dwivedi, Mallawaarachchi, and Alvarado (2017) <doi:10.1002/sim.7263>, the package facilitates a range of statistical tests, encompassing independent t-tests, paired t-tests, and one-way Analysis of Variance (ANOVA) F-tests. The nonparboot() function undertakes essential computations, yielding detailed outputs which include test statistics, effect sizes, confidence intervals, and bootstrap distributions. Further, 'npboottprm' incorporates an interactive 'shiny' web application, nonparboot_app(), offering intuitive, user-friendly data exploration.

npboottprm

The goal of npboottprm is to provide a robust tool for conducting nonparametric bootstrap tests with pooled resampling. These tests are ideal for small sample sizes and include the independent t-test, paired t-test, and F-test. The package employs methods presented in Dwivedi, Mallawaarachchi, and Alvarado (2017).

Installation

You can install the released version of npboottprm from CRAN:

install.packages("npboottprm")

To install the development version of npboottprm from GitHub, use the devtools package:

# install.packages("devtools")
devtools::install_github("mightymetrika/npboottprm")

Nonparametric bootstrap t-test

The following example demonstrates how to use the nonparboot() function to conduct an independent t-test.

library(npboottprm)

# Use the simulated data included in the package
print(data_t)
#>             x    grp
#> 1  -0.4545644 Group1
#> 2  -1.0203803 Group1
#> 3  -0.8381422 Group1
#> 4   1.2075650 Group1
#> 5   0.6658781 Group1
#> 6   1.7392430 Group2
#> 7  -0.5869082 Group2
#> 8  -0.4396707 Group2
#> 9   0.1153781 Group2
#> 10  2.2982103 Group2

# Run the test
res_t <- nonparboot(data = data_t,
                    x = "x",
                    grp = "grp",
                    nboot = 1000,
                    test = "t",
                    conf.level = 0.95,
                    seed = 183)

# Print the results, excluding the bootstrap distributions
print(res_t[!names(res_t) %in%
              c("bootstrap.stat.dist", "bootstrap.effect.dist")])
#> $p.value
#> [1] 0.341
#> 
#> $orig.stat
#>          t 
#> -0.9742938 
#> 
#> $ci.stat
#>      2.5%     97.5% 
#> -2.421260  2.060161 
#> 
#> $effect.size
#> [1] -0.7131793
#> 
#> $ci.effect.size
#>      2.5%     97.5% 
#> -1.307315  1.243749

Nonparametric bootstrap paired t-test

The following example demonstrates how to use the nonparboot() function to conduct a paired t-test.

# Use the simulated data included in the package
print(data_pt)
#>              x          y
#> 1  -0.04210576  0.5743731
#> 2  -0.78606271  0.4955500
#> 3   0.73510435  1.0370887
#> 4  -0.59760139  1.3066557
#> 5   0.73802810  0.6191670
#> 6  -1.84689646 -0.2261067
#> 7  -0.83164309  0.6387438
#> 8  -1.33994927  2.3328887
#> 9   0.05511817  0.5356024
#> 10 -0.38908692  2.0891858

# Run the test
res_pt <- nonparboot(data = data_pt,
                     x = "x",
                     y = "y",
                     nboot = 1000,
                     test = "pt",
                     conf.level = 0.95,
                     seed = 166)

# Print the results, excluding the bootstrap distributions
print(res_pt[!names(res_pt) %in%
               c("bootstrap.stat.dist", "bootstrap.effect.dist")])
#> $p.value
#> [1] 0.005
#> 
#> $orig.stat
#>         t 
#> -3.816044 
#> 
#> $ci.stat
#>      2.5%     97.5% 
#> -2.331819  2.353130 
#> 
#> $effect.size
#> [1] -1.370824
#> 
#> $ci.effect.size
#>       2.5%      97.5% 
#> -0.9424713  0.8814061

Nonparametric bootstrap F-test

The following example demonstrates how to use the nonparboot() function to conduct an F-test.

# Use the simulated data included in the package
print(data_f)
#>             x    grp
#> 1  -1.2659165 Group1
#> 2  -0.2102170 Group1
#> 3  -0.2203267 Group1
#> 4  -0.2113811 Group1
#> 5  -1.1601362 Group1
#> 6   1.3723773 Group2
#> 7   0.3764606 Group2
#> 8   0.4393153 Group2
#> 9   0.6279528 Group2
#> 10  0.9103877 Group2
#> 11  2.5440636 Group3
#> 12  1.0701797 Group3
#> 13  0.8459235 Group3
#> 14  2.2931195 Group3
#> 15  2.0675429 Group3

# Run the test
res_f <- nonparboot(data = data_f,
                    x = "x",
                    grp = "grp",
                    nboot = 1000,
                    test = "F",
                    conf.level = 0.95,
                    seed = 397)

# Print the results, excluding the bootstrap distributions
print(res_f[!names(res_f) %in%
              c("bootstrap.stat.dist", "bootstrap.effect.dist")])
#> $p.value
#> [1] 0
#> 
#> $orig.stat
#> [1] 20.46528
#> 
#> $ci.stat
#>       2.5%      97.5% 
#> 0.02517111 4.86060520 
#> 
#> $effect.size
#> [1] 0.7732878
#> 
#> $ci.effect.size
#>        2.5%       97.5% 
#> 0.004177655 0.447544364

Please note that the examples provided here use simulated data included in the package. When using this package with your own data, replace data_t, data_pt, and data_f with your own data frames, and adjust the x, y, and grp parameters as needed.

References

Dwivedi AK, Mallawaarachchi I, Alvarado LA (2017). “Analysis of small sample size studies using nonparametric bootstrap test with pooled resampling method.” Statistics in Medicine, 36 (14), 2187-2205.

Metadata

Version

0.3.2

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