multivariance.test: independence tests based on (total-/2-/3-) multivariance

Description Usage Arguments Details Value References Examples

View source: R/multivariance-functions.R

Description

This performs the (specified by type and p.value.type) independence test for the columns of a sample matrix.

Usage

1
2
3
4
5
6
7
8
multivariance.test(
  x,
  vec = 1:ncol(x),
  type = "total",
  p.value.type = "pearson_approx",
  verbose = TRUE,
  ...
)

Arguments

x

matrix, each row is a sample

vec

vector which indicates which columns are treated as one sample

type

one of "independence", "pairwise independence", "multi", "total", "m.multi.2", "m.multi.3"

p.value.type

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

verbose

logical, if TRUE meaningful text output is generated.

...

these are passed to cdm

Details

For the use of vec see the examples below and the more detailed explanation of this argument for multivariance.

The types "independence" and "total" are identical: an independence test is performed.

Also the types "pairwise independence" and "m.multi.2" are identical: a test of pairwise independence is performed.

The type "m.multi.3", performs a test for 3-independence, assuming pairwise independence. The type "multi" performs a test for n-independence, assuming (n-1)-independence.

There are several ways (determined by p.value.type) to estimate the p-value: 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, its p-value estimates are only valid for p-values lower than 0.215 - values above should be interpreted as "values larger than 0.215". Finally, "pearson_unif" uses fixed parameters in Pearson's estimate, it is only applicable for univariate uniformly distributed marginals

All tests are performed using the standard euclidean distance. Other distances can be supplied via the ..., see cdm for the accepted arguments.

Value

A list with class "htest" containing the following components:

statistic

the value of the test statistic,

p.value

the p-value of the test statistic,

method

a character string indicating the type of test performed,

data.name

a character string giving the name(s) of the data.

References

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

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
# an independence test
multivariance.test(dep_struct_several_26_100,p.value.type = "distribution_free") # conservative
multivariance.test(dep_struct_several_26_100,p.value.type = "resample") #sharp but slow
multivariance.test(dep_struct_several_26_100,p.value.type = "pearson_approx") #

# as an example, all tests for one data set:
coins100 = coins(100)
for (ty in c("total","m.multi.2","m.multi.3","multi"))
 for (pvt in c("distribution_free","resample","pearson_approx"))
  print(multivariance.test(coins100,type=ty,p.value.type = pvt))

# using the vec argument:
x = matrix(rnorm(50*6),ncol = 10) # a 50x6 data matrix
vec = c(1,2,3,4,5,6) # each column is treated as one variable
multivariance.test(x,vec,p.value.type = "distribution_free") # is the same as the default

vec = c(1,2,2,1,3,1)
# column 1,4,6 are treated as one variable
# column 2,3 are treated as one variable
# column 5 is treated as one variable
multivariance.test(x,vec,p.value.type = "distribution_free")

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