View source: R/appl_indeptest.r

GET.cdf | R Documentation |

Permutation-based test of independence in a bivariate vector using the empirical joint cumulative distribution function as the test statistic.

GET.cdf(X, ngrid = c(20, 20), nsim = 999, seq.x = NULL, seq.y = NULL, ...)

`X` |
A matrix with n rows and 2 columns. Each row contains one bivariate observation. |

`ngrid` |
Vector with two elements, giving the number of grid points to be used in the test statistic for each of the two marginals. The default is 20 in each marginal. |

`nsim` |
The number of random permutations used. |

`seq.x` |
For the first marginal, the values at which the empirical cumulative distribution function will be evaluated. If NULL (the default), sequence of quantiles will be used, equidistant in terms of probability. |

`seq.y` |
For the second marginal, the values at which the empirical cumulative distribution function will be evaluated. If NULL (the default), sequence of quantiles will be used, equidistant in terms of probability. |

`...` |
Additional parameters to be passed to |

Permutation-based test of independence in a bivariate sample,
based on empirical joint cumulative distribution function
computed on a grid of `ngrid[1]`

times `ngrid[2]`

arguments.
The grid points are chosen according to the quantiles of the
marginal distributions.

If the observed data are the pairs *{(X_1, Y_1), ..., (X_n, Y_n)}*,
the permutations are obtained by randomly permuting the values
in the second marginal, i.e. *{(X_1, Y_{pi(1)}), ..., (X_n, Y_{pi(n)})}*.

The test itself is performed using the global envelope test of the chosen version,
see the argument `type`

of `global_envelope_test`

.

Dvořák, J. and Mrkvička, T. (2022). Graphical tests of independence for general distributions. Computational Statistics 37, 671–699.

# Generate sample data data <- matrix(rnorm(n=200), ncol=2) %*% matrix(c(1,1,0,1), ncol=2) plot(data) # Compute the CDF test and plot the significant regions res <- GET.cdf(data, ngrid=c(20,15), nsim=1999) plot(res) # Extract the p-value attr(res,"p")

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.