Learn R Programming

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.

Copy Link

Version

Install

install.packages('npboottprm')

Monthly Downloads

185

Version

0.3.2

License

MIT + file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

Mackson Ncube

Last Published

September 13th, 2024

Functions in npboottprm (0.3.2)

nonparboot

Nonparametric Bootstrap Test with Pooled Resampling for Small Sample Sizes
replext_t2_c3.2

Replicate and Extend Simulation Results from Table 2 Cell 3.2
replext_t3_c1.2

Replicate and Extend Statistical Power Analysis from Table 3 Cell 1.2
replext_t2_c4.2

Replicate and Extend Simulation Results from Table 2 Cell 4.2
replext

Replext Simulation Shiny App
replext_t3_c1.1

Replicate and Extend Simulation Results for Statistical Power from Table 3 Cell 1.1
replext_t2_c2.2

Replicate and Extend Simulation Results from Table 2 Cell 2.2
replext_t2_c3.1

Replicate and Extend Simulation Results from Table 2 Cell 3.1
replext_t3_c2.2

Replicate and Extend Statistical Power Analysis from Table 3 Cell 2.2
data_t_mi

Simulated Data for Independent T-test with Missing Outcomes
replext_t3_c3.1

Replicate and Extend Statistical Power Analysis from Table 3 Cell 3.1
replext_t3_c2.1

Replicate and Extend Statistical Power Analysis from Table 3 Cell 2.1
replext_t4_c2.1

Replicate and Extend Simulation Results from Table 4 Cell 2.1
replext_t4_c3.1

Replicate and Extend Simulation Results from Table 4 Cell 3.1
data_t

Simulated Data for Independent T-test
replext_t2_c4.1

Replicate and Extend Simulation Results from Table 2 Cell 4.1
replext_t5_c1.1

Replicate and Extend Simulation Results for Paired Distributions
replext_t5_c2.3

Replicate and Extend Simulation Results for Paired Distributions with Varied Skewness and Standard Deviations
replext_t5_c2.2

Replicate and Extend Simulation Results for Paired Distributions with Different Skewness Levels
replext_t5_c1.2

Replicate and Extend Simulation Results for Paired Distributions with Different Variances
replext_t4_c1.1

Replicate and Extend Simulation Results from Table 4 Cell 1.1
replext_t3_c5.2

Replicate and Extend Statistical Power Analysis from Table 3 Cell 5.2
replext_t3_c3.2

Replicate and Extend Statistical Power Analysis from Table 3 Cell 3.2
replext_t2_c2.1

Replicate and Extend Simulation Results from Table 2 Cell 2.1
replext_t2_c1.2

Replicate and Extend Simulation Results from Table 2 Cell 1.2
replext_t5_c2.1

Replicate and Extend Simulation Results for Paired Distributions with Skewness and Different Variances
replext_t3_c4.2

Replicate and Extend Statistical Power Analysis from Table 3 Cell 4.2
replext_t3_c5.1

Replicate and Extend Statistical Power Analysis from Table 3 Cell 5.1
replext_t5_c1.3

Replicate and Extend Simulation Results for Paired Distributions with Skewness
replext_t3_c4.1

Replicate and Extend Statistical Power Analysis from Table 3 Cell 4.1
replext_t4_c4.1

Replicate and Extend Simulation Results from Table 4 Cell 4.1
replext_ts1_c1.1

Replicate and Extend Simulation Results from Table S1 Cell 1.1
replext_t6_c1.3

Replicate and Extend Statistical Power Simulation Results for Paired Distributions with Skewness
replext_t6_c2.1

Replicate and Extend Statistical Power Simulation Results for Paired Distributions with Skewness and Different Variances
replext_t4_c5.1

Replicate and Extend Simulation Results from Table 4 Cell 5.1
replext_ts1_c3.1

Replicate and Extend Simulation Results from Table S1 Cell 3.1
replext_ts1_c2.1

Replicate and Extend Simulation Results from Table S1 Cell 2.1
replext_ts2_c1.1

Replicate and Extend Type I Error Rates for ANOVA in a Three-Sample Setting
replext_ts3_c1.2

Replicate and Extend Statistical Power Analysis for ANOVA
replext_t4_c6.1

Replicate and Extend Simulation Results from Table 4 Cell 6.1
replext_t4_c7.1

Replicate and Extend Simulation Results from Table 4 Cell 7.1
replext_ts2_c3.2

Replicate and Extend Type I Error Rates for ANOVA with Varied Skewness and Standard Deviations
replext_t6_c2.3

Replicate and Extend Statistical Power Simulation Results for Paired Distributions with Varied Skewness and Standard Deviations
replext_ts2_c4.1

Replicate and Extend Type I Error Rates for ANOVA with Skewness in Specific Sample Size Combinations
replext_t6_c2.2

Replicate and Extend Statistical Power Simulation Results for Paired Distributions with Different Skewness Levels
replext_ts3_c2.1

Replicate and Extend Statistical Power Analysis for ANOVA with Skewness
replext_ts3_c4.2

Replicate and Extend Statistical Power Analysis for ANOVA with Specific Sample Size Combinations
replext_ts2_c2.1

Replicate and Extend Type I Error Rates for ANOVA with Skewness
replext_ts2_c1.2

Replicate and Extend Type I Error Rates for ANOVA in a Different Setting
runSimulation

Execute Simulation Based on User Inputs
replext_ts3_c2.2

Replicate and Extend Statistical Power Analysis for ANOVA with Skewness and Varied Standard Deviations
replext_ts3_c3.1

Replicate and Extend Statistical Power Analysis for ANOVA with Diverse Skewness Parameters
replext_t6_c1.1

Replicate and Extend Statistical Power Simulation Results for Paired Distributions
replext_t6_c1.2

Replicate and Extend Statistical Power Simulation Results for Paired Distributions with Different Variances
text_to_char_vector

Convert Comma-Separated String to Character Vector
replext_ts3_c3.2

Replicate and Extend Statistical Power Analysis for ANOVA with Varied Skewness and Standard Deviations
replext_ts3_c4.1

Replicate and Extend Statistical Power Analysis for ANOVA with Skewness in Specific Sample Size Combinations
replext_ts2_c2.2

Replicate and Extend Type I Error Rates for ANOVA with Skewness and Varied Standard Deviations
replext_ts2_c3.1

Replicate and Extend Type I Error Rates for ANOVA with Diverse Skewness Parameters
replext_ts2_c4.2

Replicate and Extend Type I Error Rates for ANOVA with Specific Sample Size Combinations
replext_ts3_c1.1

Replicate and Extend Statistical Power Analysis for ANOVA in a Three-Sample Setting
appendInputParams

Append Input Parameters to Data Frame
nonparboot_app

Shiny App for Nonparametric Bootstrap Tests with Pooled Resampling
data_f_mi

Simulated Data for F-test with Missing Outcomes
data_pt_id

Simulated Data for Paired T-test Using Identically Distributed Data
remove_na

Remove NA values from vectors
data_f_id

Simulated Data for F-test Using Identically Distributed Data
getUIParams

Generate UI Elements for Selected Cell Block
bootstrap_t_sample

Internal Bootstrap Sampling Function for T-tests
bootstrap_f_sample

Internal Bootstrap Sampling Function for F-tests
data_pt

Simulated Data for Paired T-test
data_pt_mi

Simulated Data for Paired T-test with Missing Data
data_f

Simulated Data for F-test
getCellBlocks

Generate a List of Available Cell Blocks
bootstrap_pt_sample

Internal Bootstrap Sampling Function for Paired T-tests
replext_pgsql

Replext Simulation Shiny App with Database Integration
replext_t2_c1.1

Replicate and Extend Simulation Results from Table 2 Cell 1.1