Generate bootstrap distribution of p values based on user given two sample tests.

Description

Performs bootstrap to generate empirical distribution of order statistics of p values from two sample tests.

Usage

1
2
pboot.2sample(X, Y, B = 100, test = t.test, nbx = NROW(X),
  nby = NROW(Y), ncpus = 8)

Arguments

X

matrix of data, each row is an independent observation nxm

Y

matrix of data, sample 2. each row is an independent observation nxm.

B

bootstrap sample size

test

function for testing. default is t.test(). Must return a data frame with p value in $p.value.

nbx

Sample size for the bootstrap samples. Default is NROW(X), which is same as the original data sample size.

nby

Sample size for the bootstrap samples for second dataset. Default is NROW(X), which is same as the original data sample size.

ncpus

Number of cpus to use for bootstrap. We use parallel:multicore() to parallelize the bootstrap. For windows, use ncpus = 1, for any other machine, you can use the maximum permissible number for your system.

Details

We generate the bootstrap distribution of the order statistics of the p values. We are performing one sample test on each coordinate of the original dataset. The bootstrap used here is standard version with default bootstrap sample size being equal to data sample size. The default one sample test is t.test(), however the user can provide their own test functions. The only requirement is that it must return p values in $p.value column of the output. The bootstrap is parallelized using multicore from the library parallel. Windows machines at this point does not support using multiple cores, so the ncpus option should be equal to 1 for windows. For other systems, it can be higher to speed up the process. We also use a transofrmation of the p values, by default the transformation is -log(1-p). But the user can provide their own transformation function. They should be monotonically increasing functions.

Value

matrix of dimension Bxm. (Where m coordinates), each row indicates transformed p values for that bootstrap sample.

Examples

1
2
3
4
5
6
7
8
9
## Not run: 
n = 50;m = 250;m0 = 20;
sigeff = 1;
Sigma <- 0.25*diag(m)
X <- datgen(n,m,m0,sigeff,Sigma = Sigma)
porder <- pboot.1sample(X=X,B=100,ncpus = 1)
plotpboot(porder) 

## End(Not run)