This function checks for missing data for each pair individually. It then uses the
kern
function to kernel regress x on y, and conversely y on x. It
needs the library `np' which reports R-squares of each regression. This function
reports their square roots after assigning them the observed sign of the Pearson
correlation coefficient. Its advantages are: (i)
It is asymmetric yielding causal direction information,
by relaxing the assumption of linearity implicit in usual correlation coefficients.
(ii) The r* correlation coefficients are generally larger upon admitting
arbitrary nonlinearities. (iii) max(|R*ij|, |R*ji|) measures (nonlinear)
dependence.
For example, let x=1:20 and y=sin(x). This y has a perfect (100 percent)
nonlinear dependence on x and yet Pearson correlation coefficient r(xy)
-0.0948372 is near zero and usual confidence interval (-0.516, 0.363)
includes zero, implying that it is not different from zero.
This shows a miserable failure of traditional r(x,y) to measure dependence
when nonlinearities are present.
gmcmtx0(mym, nam = colnames(mym))
A matrix of data on variables in columns
Column names of the variables in the data matrix
A non-symmetric R* matrix of generalized correlation coefficients
Vinod, H. D.'Generalized Correlation and Kernel Causality with Applications in Development Economics' in Communications in Statistics -Simulation and Computation, 2015, https://doi.org/gffn86
Vinod, H. D. 'Matrix Algebra Topics in Statistics and Economics Using R', Chapter 4 in 'Handbook of Statistics: Computational Statistics with R', Vol.32, co-editors: M. B. Rao and C.R. Rao. New York: North Holland, Elsevier Science Publishers, 2014, pp. 143-176.
Vinod, H. D. 'New exogeneity tests and causal paths,' Chapter 2 in 'Handbook of Statistics: Conceptual Econometrics Using R', Vol.32, co-editors: H. D. Vinod and C.R. Rao. New York: North Holland, Elsevier Science Publishers, 2019, pp. 33-64.
Zheng, S., Shi, N.-Z., and Zhang, Z. (2012). 'Generalized measures of correlation for asymmetry, nonlinearity, and beyond,' Journal of the American Statistical Association, vol. 107, pp. 1239-1252.
See Also as gmcmtxBlk
for a more general version using
blocking.
# NOT RUN {
gmcmtx0(mtcars[,1:3])
# }
# NOT RUN {
set.seed(34);x=matrix(sample(1:600)[1:99],ncol=3)
colnames(x)=c('V1', 'v2', 'V3')
gmcmtx0(x)
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab