resample.multivariance: resampling (total /m-) multivariance

Description Usage Arguments Details Value References Examples

View source: R/multivariance-functions.R

Description

The distribution of the test statistic under the hypothesis of independence is required for the independence tests. This function generates approximate samples of this distribution either by sampling without replacement (permutations) or by sampling with replacement (bootstrap).

Usage

1
2
3
4
5
6
7
8
resample.multivariance(
  x,
  vec = 1:ncol(x),
  times = 300,
  type = "multi",
  resample.type = "permutation",
  ...
)

Arguments

x

matrix, the rows should be iid samples

vec

vector, which indicates which columns of x are treated together as one sample

times

integer, number of samples to generate

type

one of "multi","total","m.multi.2","m.multi.3","all"

resample.type

one of "permutation", "bootstrap". The samples are generated without replacement (permutations) or with replacement (bootstrap).

...

is passed to cdms, multivariance, total.multivariance, m.multivariance, respectively.

Details

The resampling is done by sampling from the original data either without replacement ("permutation") or with replacement ("bootstrap"). Using resampling without replacement is (much) faster (due to special identities which only hold in this case).

For convenience also the actual (total /m-) multivariance is computed and its p-value.

Value

A list with elements

resampled

the (total/m-)multivariances of the resampled data,

original

the (total/m-)multivariance of the original data,

p.value

the p-value of the original data, computed using the resampled data

References

For the theoretic background see the reference [3] given on the main help page of this package: multivariance-package.

Examples

1
2
3
re.m = resample.multivariance(matrix(rnorm(30*2),nrow = 30),
                        type= "multi",times = 300)$resampled
curve(ecdf(re.m)(x), xlim = c(0,4),main = "empirical distribution of the test statistic under H_0")

multivariance documentation built on Oct. 6, 2021, 5:08 p.m.