Skip to content

Generalized correlation coefficients  #183

Open
@DominiqueMakowski

Description

@DominiqueMakowski

We could add that as a method.

Implemented in the generalCorr package.

generalCorr::gmcmtx0(mtcars[1:4])   
#>             mpg        cyl       disp         hp
#> mpg   1.0000000 -0.8557900 -0.9508994 -0.9379374
#> cyl  -0.9433125  1.0000000  0.9759183  0.9583212
#> disp -0.8941676  0.9151419  1.0000000  0.9306311
#> hp   -0.8530474  0.8446589  0.8170031  1.0000000

Created on 2021-05-29 by the reprex package (v1.0.0)

This function runs a kernel regression for each pair (x on y, and conversely y on x) and returns the generalized correlation coefficient (R*), which corresponds to the square roots of the R2 with the observed sign of the Pearson correlation coefficient.

Among some of the interesting properties, max(|R*xy|, |R*yx|) measures (nonlinear) dependence. For example, let x=1:20 and y=sin(x). This y has a perfect (100%) nonlinear dependence on x, and yet Pearson correlation coefficient r(xy) -0.0948372 is near zero. "This shows a miserable failure of traditional r(x,y) to measure dependence when nonlinearities are present".

generalCorr::gmcmtx0(data.frame(x=1:20, y=sin(1:20)))
                
#>    x           y
#> x  1 -0.04847292
#> y -1  1.00000000

Created on 2021-05-29 by the reprex package (v1.0.0)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions