| multivariance.test {multivariance} | R Documentation |
independence tests based on (total-/2-/3-) multivariance
Description
This performs the (specified by type and p.value.type) independence test for the columns of a sample matrix.
Usage
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 |
p.value.type |
one of |
verbose |
logical, if TRUE meaningful text output is generated. |
... |
these are passed to |
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:
statisticthe value of the test statistic,
p.valuethe p-value of the test statistic,
methoda character string indicating the type of test performed,
data.namea 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
# 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")