Description Usage Arguments Value References Examples
Estimates de p-value for calculated Wijayatunga coefficients (Wijayatunga, 2016) for the given variables.
1 |
x |
A vector or a matrix/data frame of categorical variables. |
y |
A vector of categorical values. It is not necessary if x is a matrix or a data frame with more than one column. |
mv |
The maximum number of different categories (it is considered to be the same for all variables in x, or for x and y). Should be used only the maximum possible value was not used in any of the variables in x, or in x or y. |
iterations |
The number of iterations to be calculated. Defaults to 100 (but in practical research it should be at least 1000). |
seed |
The random seed for replicability purposes. |
A matrix of p-values for the Wijayatunga coefficients.
Wijayatunga, P. (2016). "A geometric view on Pearson's correlation coefficient and a generalization of it to non-linear dependencies". *Ratio Mathematica*, 30, 3-21.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | ### Data generating process
DGP <- function(seed, n) {
set.seed(seed)
tmp <- copula::indepCopula(dim = 2) # Independence copula
cop <- copula::rCopula(n, tmp) # Uncorrelated variables
cp3 <- pnorm(qnorm( sqrt(cop[,1] * cop[,2]) )) # Collider
data <- data.frame( "v1"=qbinom(cop[,1], 4, .7) + 1, # Combine in same dataset
"v2"=qbinom(cop[,2], 4, .5) + 1,
"v3"=qbinom(cp3, 4, .3) + 1 )
return(data)
}
### Simulate data
data <- DGP(1, 200)
### Get W coefficients
W_pvalue <- wcor.test(data, iterations=100, seed=169)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.