independence.test {multivariance}R Documentation

test for independence

Description

This computes a test of independence for the columns of a sample matrix (required for the resampling test) or for given centered distance matrices (only possible for the distribution-free test).

Usage

independence.test(x, vec = 1:ncol(x), alpha = 0.05,
  type = "distribution_free", verbose = TRUE, ...)

Arguments

x

either a data matrix or a list of centered distance matrices

vec

if x is a matrix, then this indicates which columns are treated together as one sample; if x is a list, these are the indexes for which the multivariance is calculated. The default is all columns and all indexes, respectively.

alpha

significance level

type

one of "pearson_approx","distribution_free","resample"

verbose

logical, if TRUE meaningful text output is generated.

...

these are passed to cdms (which is only invoked if x is a matrix)

Details

For a test with p-value output (as standard for tests in R) see multivariance.test.

The "pearson_approx" and "resample" are approximately sharp. The latter is based on a resampling approach and thus much slower. The "distribution_free" test might be very conservative. The centered distance matrices can be prepared by cdms. But note that for the test based on Pearson's approximation and for the resampling test, the data matrix has to be given.

Value

Returns TRUE if the hypothesis of independence is NOT rejected, otherwise FALSE.

References

For the theoretic background see the references given on the main help page of this package: multivariance-package.

Examples

independence.test(coins(100)) #dependent sample which is 2-independent
independence.test(coins(100),type = "resample") #dependent sample which is 2-independent

independence.test(coins(100)[,2:3]) # independent sample
independence.test(coins(100)[,2:3],type = "resample") # independent sample

independence.test(coins(10),type = "resample") #dependent sample which is 2-independent
independence.test(coins(10)[,2:3],type = "resample") #dependent sample which is 2-independent


[Package multivariance version 2.2.0 Index]