Learn R Programming

copBasic (version 2.2.16)

wolfCOPtest_check: Empirical Comparison by Simulation between Independence Test by Schweizer--Wolff Sigma from this package to Independence Test from copula Package

Description

Report on a simulation study of empirical performance an Independence test based on a Schweizer--Wolff Sigma test for \(\sigma_\mathbf{C}\) stemming from a Null hypothesis of \(\mathrm{NULL} : \mathbf{C} = \mathbf{\Pi} = uv\) (Independence copula, P), where \(\sigma_\mathbf{C}\) is defined and computed under wolfCOP. The study uses a Clayton copula (CLcop) is \(\mathbf{C}_{\Theta}(u,v)\) with parameter \(\Theta\) set through Kendall Tau (tauCOP) by \(\tau = \Theta/(\Theta+2)\) and \(\Theta = 2\tau/(1-\tau)\).

The copBasic package provides an Independence test with approximated p-values in wolfCOPtest, and the copula package provides an Independence test by copula function indepTest. Both tests can detect dependency even if Kendall Tau and Spearman Rho are equal to zero. Example of comparison between the two tests is in the Examples in wolfCOPtest.

The wolfCOP uses Schweizer--Wolff Sigma \(\sigma_\mathbf{C}\) of a copula according to Nelsen (2006, p. 209) by

$$\sigma_\mathbf{C} = 12\int\!\!\int_{\mathcal{I}^2} \bigl|\mathbf{C}(u,v) - uv\bigr|\,\mathrm{d}u\mathrm{d}v\mbox{,}$$

which is \(0 \le \sigma_\mathbf{C} \le 1\). The wolfCOPtest is based on simulation of a sampling estimator of \(\sigma_\mathbf{C}\) and detailed parameterization of a three-parameter probability distribution by the method of L-moments. The sampling estimator used (refer to wolfCOP) was $$\hat{\sigma}_\mathbf{C} = \frac{12}{n^2 - 1} \sum_{i=1}^n\sum_{j=1}^n \bigg|\hat{\mathbf{C}}_n\biggl(\frac{i}{n}, \frac{j}{n}\biggr) - \frac{i}{n}\times\frac{j}{n}\bigg|\mbox{,}$$ where \(\hat{\mathbf{C}}_n\) is the simplest empirical copula of $$\hat{\mathbf{C}}_n\biggl(\frac{i}{n}, \frac{j}{n}\biggr) = \frac{1}{n}\bigl[\# \mathrm{\ of\ } (U_k \le U_i, V_k \le V_j)\bigr]\mbox{.}$$

The copula package in function indepTestSim is based around the test statistic (as a bivariate form) (Hofert et al., 2017, p. 174) (for such a form refer also to hoefCOP)

$$S_n^{\mathbf{\Pi}} = \int\!\!\int_{\mathcal{I}^2} n\bigl(\mathbf{C}_n(u,v) - uv\bigr)^2\,\mathrm{d}u\mathrm{d}v\mbox{,}$$

where \(\mathbf{C}_n(u,v)\) is an empirical copula.

Originating literature leading to \(S_n^{\mathbf{\Pi}}\) through citation by Hofert et al., (2017, p. 173--178) are Deheuvels (1981), Genest and Rémillard (2004), and Genest et al. (2007). Genest and Rémillard (2004) show, repeated in Hofert et al. (2017, p. 175), and implemented in copula function indepTest that approximate p-values can be computed by simulation of size \(N\) by

$$\frac{1}{N+1}\biggl(\sum_{k=1}^N \mathbf{1}\bigl(S_n^{\mathbf{\Pi},(k)} \ge S_n^{\mathbf{\Pi}}\bigl) + \frac{1}{2}\biggr)\mbox{,}$$

for \(S_n^{\mathbf{\Pi}}\) being a large simulation of the \(\Pi\) copula. The simulation study described in the next section, used a sample size of \(N = 100{,}000\) for the copula package function J <- indepTestSim(n, 2, N=100000) where \(n\) is the sample size of the pending test data. This J object was used for the indepTest calls. This is a required step unique to copula package implementation as described by Hofert et al. (2017, p. 175) and package documentation. So, the \(N\) simulation size in the aforementioned equation is the simulation size on which indepTest bases its p-values and therefore is unique to needs of the copula package.

This Simulation Study---A sequence of \(\tau \in (0,0.02, \cdots, 0.48,0.50)\) were converted to parameters \(\Theta\) of the Clayton copula (CLcop). Values for \(\tau\) were selected to start the \(\mathbf{C}_{\Theta=0} \equiv \mathbf{\Pi}\), which provides a chance to study results with the condition of the Null being \(\mathbf{\Pi}\). The purpose is to compare for a range of sample sizes (\(n\)) the rejection performance of wolfCOPtest to the copula function indepTest. The script is provided in inst/make_wolfCOPtest/chck_wolfCOPtestCL.R of this copBasic package source code.

For each of the \(\tau\) values and hence Clayton copula parameter \(\Theta\) values, a \(\mathbf{\Pi}\) sample is drawn for each of sample sequences of sizes \(n \in (5,20;1), (22,50;2), (55,100;5)\). For a given sample, the wolfCOPtest and indepTest were made and p-values compared to the alpha = 0.05 statistical significance level; a binary then is recorded as whether the null hypothesis of independence is rejected or not.

The aforementioned process was repeated for large simulation sizes of \(m = 150{,}000\) for all \(\tau\) used (total simulation \(\sum m = 6{,}519{,}000\)). The differences in simulation size are heuristic to enhance the precision of the results for small \(\tau\) values. In the end, for each of the \(\tau\) for each of the \(n\) for simulation size \(m\), the total number of rejections of the null hypothesis was counted for each method and divided by the number of simulations, which converts the binary into a rejection rate. The rejection rate between methods at the alpha = 0.05 significance level becomes the measure on which to assess performance of wolfCOPtest to indepTest.

The relation between simulated rejection rates for independence at alpha = 0.05 significance level for a selected subset of \(\tau \in (0.00, 0.48; 0.04)\) is shown in figure 1. The \(\tau\) were subsetted for graphical reasons. The lower left corner as a zoom region demarcated that is shown in figure 2. Each of the two figures as the alpha = 0.05 significance level drawn as a horizontal line.

The figures have the rejection rates for wolfCOPtest drawn as solid lines and rejections rates for indepTest drawn as the dashed lines. The line color ramps with the \(\tau\) value and these Kendall Taus are labeled and value plotted between the two curves. The two curve types show that both methods have a similarity of performance. On scrutiny, the curves for wolfCOPtest generally plot just above those for the indepTest. This is an indication of higher rejection rates of the null hypothesis as departure from independence (\(\tau > 0\)) seems to increases but only for a range of sample sizes. Figure 1 shows that as sample sizes become large relative to the \(\tau\) is a convergence towards 100-percent rejection (a rejection rate \(= 1\)).

Figure 2 is a zoom into the lower left corner of figure 1 and is an emphasis of the method performance for very small sample sizes. It appears that indepTest for \(\tau \le 0.02\) barely outperforms wolfCOPtest. A general conclusion, however, from the figures is that the wolfCOPtest by copBasic is either better tuned empirically than how indepTest is implemented by copula or that the absolute value operation (difference between empirical copula and \(\mathbf{\Pi} = uv\)) in the definition of \(\sigma_\mathbf{C}\) in lieu of the square operation (squared difference between empirical copula and \(\mathbf{\Pi} = uv\)) in \(S_n^{\mathbf{\Pi}}\).

The mean difference between wolfCOPtest and indepTest rejection is about 1 percent for the \(\tau \in (0,0.02, \cdots, 0.48,0.50)\) with \(n \in (5,20;1), (22,50;2), (55,100;5)\) totalling about 3.7 million simulations. This is evidence that both methods perform similar to each other, which provides for documentation such as this for copBasic that the Schweizer--Wolff Sigma test is well implemented beyond the evidence documented in Examples of wolfCOPtest.

The results in figures 1 and 2 are compelling. Both figures as exemplified by empirical simulation that wolfCOPtest does out perform the independence test of indepTest as implemented within the copula package. Though the rejection rates of Kendall Tau or Spearman Rho are not otherwise indicted in those two figures (figs. 1 and 2), the practitioner could study the scripted results of inst/make_wolfCOPtest/chck_wolfCOPtestCIRC.R, which is built around application of the Circula copula (CIRCcop) to further explore the performance of the Schweizer--Wolff Sigma test. Those results for \(m = 150{,}000\) are shown in figure 3 and show for that copula (CIRCcop) that wolfCOPtest continues to outperform indepTest in terms of rejection at the 0.05 significance level.

Figure 3 also has highlighted at 50\(\times\) the computed rejection of independence, the trajectory of the rejection of independence from the Circular copula by well-known statistics of Kendall tau and Spearman Rho. The trajectories of the simulations for those two statistics require a multiplication of \(50\) to avoid changes in vertical scale and plotting of a second vertical axis on the right.

A quite curious aspect is that the rejection rates dip below the alpha = 0.05 for sample sizes \(n \in 6, \cdots, 19\) and possibly this is related to algorithmic estimation of nonexceedance probabilities for small samples. Beyond \(n = 20\) both methods reject with increasing regularity of independence. By \(n \approx 80\) but methods are rejecting independence at 100 percent. However, within the sample range of about \(n \in (20+, \cdots, 80)\), wolfCOPtest is superior.

Ultimately, it is not known for all settings or sample size whether or not wolfCOPtest will show to be generally more precise at rejection of Independence for all sample sizes. This assertion is based entirely on the heuristics of empirical simulation. Evidence is provided, however, in this copBasic documentation that the implementation of a Schweizer--Wolff Sigma test appears to have marginally better performance than copula package indepTest.


Figure 1. Relation between simulated rejection rates for independence at alpha = 0.05 significance level for selected sample sizes 5--100 for a Clayton copula parameterized by given Kendall Tau as indicated


Figure 2. Relation between simulated rejection rates for independence at alpha = 0.05 significance level for selected sample sizes 5--20 for a Clayton copula parameterized by given Kendall Tau as indicated


Figure 3. Relation between simulated rejection rates for independence at alpha = 0.05 significance level for selected sample sizes 5--100 for a Circular copula comprised of nothing but singular components

Arguments

Author

W.H. Asquith

References

Deheuvels, P., 1981, A non parametric test for independence: Publications de l'Institut de Statistique de l'Université de Paris, v. 26, no. 2, pp. 29--50. [Also available at https://hal.science/hal-04083801v1]

Genest, C. and Rémillard, B., 2004, Tests of independence and randomness based on the empirical copula process: Test, v. 13, pp. 335--369, tools:::Rd_expr_doi("10.1007/BF02595777").

Genest, C., Quessy, J.-F., and Rémillard, B., 2007, Asymptotic local efficiency of Cramér--von Mises tests for multivariate independence: The Annals of Statistics, v. 35, pp. 166--191, tools:::Rd_expr_doi("10.1214/009053606000000984").

Hofert, M., Kojadinovic, I., Mächler, M., and Yan, J., 2017, Elements of copula modeling with R: Cham, Switzerland, Springer, 267 p., tools:::Rd_expr_doi("10.1007/978-3-319-89635-9").

Nelsen, R.B., 2006, An introduction to copulas: New York, Springer, 269 p.

See Also

wolfCOPtest, CLcop