View source: R/PermutationTest.R
PermutationTest | R Documentation |
Perform permutation test using various dependence measures, in which Xs are quantitative, Y are categorical, alpha is an exponent on Euclidean distance, sigma is kernel parameter in kernel methods and return the test statistic, critical value, p-value and decision of the test.
PermutationTest(x, y, method, sigma, alpha, M = 200, level = 0.05)
x |
data |
y |
label of data or univariate response variable |
method |
name of permutation test method and is chosen from one of the method list: dCov, dCor, KdCov, KdCor, gCov, gCor, KgCov, Kgcor |
sigma |
kernel parameter for kenerl methods |
alpha |
exponent on Euclidean distance, in (0,2), the default value = 1 |
M |
number of permutations |
level |
significance level of the test, the default value = 0.05 |
H_0: X and Y are independent \Longleftrightarrow H_0: F(x|y=1)=F(x|Y=2)=...=F(x|Y=K)
PermutationTest
compute the p-value value of a permutation test of a (Gini) distance covariance or correlation statistics.
It is a self-contained R function the measure of dependence statistics.
The p-value is obtained by a permutation procedure. Let \hat{ρ}(ν) be the sample dependnce measure based on the orginal sample indexed by ν=\{1,2,...,n\}. Let π(ν) denote a permutation of the elements of ν and the corresponding \hat{ρ}(π) is computed for the permutated data on y labels. Under the {\cal H}_0, \hat{ρ}(ν) and \hat{ρ}(π) are identically distributed for every permutation π of ν. Hence, based on M permutations, the critical value q_{γ} is estimated by the (1-γ)100\% sample quantile of \hat{ρ}(π_m), m=1,...,M and the p-value is estimated by the proportion of \hat{ρ}(π_m) greater than \hat{ρ}(ν). Usually 100≤q M≤q 1000 is sufficient for a good estimation on the critical value or p-value. The default value is M=200.
PermutationTest
returns the p-value, critical value and decision of the permutation test of a specified method.
gCor
gCov
dCor
dCov
KgCov
KgCov
KdCov
n = 50 x <- runif(n) y <- c(rep(1,n/2),rep(2,n/2)) PermutationTest(x, y, method = "gCor", alpha = 2, M = 50 )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.