Title: | Alternative Bootstrap-Based t-Test Aiming to Reduce Type-I Error for Non-Negative, Zero-Inflated Data |
---|---|
Description: | Tu & Zhou (1999) <doi:10.1002/(SICI)1097-0258(19991030)18:20%3C2749::AID-SIM195%3E3.0.CO;2-C> showed that comparing the means of populations whose data-generating distributions are non-negative with excess zero observations is a problem of great importance in the analysis of medical cost data. In the same study, Tu & Zhou discuss that it can be difficult to control type-I error rates of general-purpose statistical tests for comparing the means of these particular data sets. This package allows users to perform a modified bootstrap-based t-test that aims to better control type-I error rates in these situations. |
Authors: | Ian Waudby-Smith [aut, cre], Pengfei Li [aut] |
Maintainer: | Ian Waudby-Smith <[email protected]> |
License: | GPL-3 | file LICENSE |
Version: | 0.1.0 |
Built: | 2024-11-05 04:11:32 UTC |
Source: | https://github.com/wannabesmith/rbtt |
Perform robust bootstrapped two-sample t-tests that aim to better control type-I error rates when comparing means of non-negative distributions with excess zero observations.
rbtt(x, y, n.boot, n.cores = 1, method = "combined", conf.level = 0.95)
rbtt(x, y, n.boot, n.cores = 1, method = "combined", conf.level = 0.95)
x |
a (non-empty) numeric vector of data values. |
y |
a (non-empty) numeric vector of data values. |
n.boot |
number of bootstrap resamples to perform |
n.cores |
number of cores to use for parallelization. Defaults to 1. If using Windows, set n.cores = 1. |
method |
Which robust bootstrapped t-test to perform. Set ‘method=1’ for a two-sample t-test under the equal variance assumption, ’method = 2' for a two-sample t-test without the equal variance assumption, and 'method = "both"' to perform both methods simultaneously. |
conf.level |
Desired confidence level for computing confidence intervals: a number between 0 and 1. |
A list (or two lists in the case of method = "combined") containing the following components:
statistic |
the value of the t-statistic. |
p.value |
the p-value for the test. |
conf.int |
a bootstrap-based confidence interval for the difference in means. |
estimate |
the estimated difference in means. |
null.value |
the hypothesized value of the mean difference, zero. |
alternative |
a character string describing the alternative hypothesis. |
method |
a character string describing the type of two-sample bootstrapped t-test used |
data.name |
a character string giving the names of the data |
x=rbinom(50,1,0.5)*rlnorm(50,0,1) y=rbinom(150,1,0.3)*rlnorm(150,2,1) rbtt(x, y, n.boot=999) # Perform bootstrap resamples on 2 cores rbtt(x, y, n.boot=999, n.cores=2) # Use methods 1 or 2 individually rbtt(x, y, n.boot = 999, method = 1) rbtt(x, y, n.boot = 999, method = 2) # Use a confidence level of 0.99 rbtt(x, y, n.boot = 999, conf.level = 0.99)
x=rbinom(50,1,0.5)*rlnorm(50,0,1) y=rbinom(150,1,0.3)*rlnorm(150,2,1) rbtt(x, y, n.boot=999) # Perform bootstrap resamples on 2 cores rbtt(x, y, n.boot=999, n.cores=2) # Use methods 1 or 2 individually rbtt(x, y, n.boot = 999, method = 1) rbtt(x, y, n.boot = 999, method = 2) # Use a confidence level of 0.99 rbtt(x, y, n.boot = 999, conf.level = 0.99)