InspectCorrelation: Inspect the Correlation

View source: R/InspectCorrelation.R

InspectCorrelationR Documentation

Inspect the Correlation

Description

Inspects the correlation between two given features using density scatter plots.

Usage

InspectCorrelation(X, Y, DensityEstimation = "SDH",

CorMethod = "spearman", na.rm = TRUE,

SampleSize = round(sqrt(5e+08), -3),

NrOfContourLines = 20, Plotter = "native",

DrawTopView = T, xlab, ylab,

main = "Spearman correlation coef.:", xlim, ylim, 

Legendlab_ggplot = "value", ...)

Arguments

X

Numeric vector [1:n], first feature (for x axis values)

Y

Numeric vector [1:n], second feature (for y axis values)

DensityEstimation

"SDH" is very fast but maybe not correct, "PDE" is slow but proably more correct.

CorMethod

method of correlation of the cor function, One of "pearson" (default), "kendall", or "spearman

SampleSize

Numeric, positiv scalar, maximum size of the sample used for calculation. High values increase runtime significantly. The default is that no sample is drawn

na.rm

Function may not work with non finite values. If these cases should be automatically removed, set parameter TRUE

NrOfContourLines

Numeric, number of contour lines to be drawn. 20 by default.

Plotter

String, name of the plotting backend to use. Possible values are: "native", "ggplot", "plotly"

DrawTopView

Boolean, True means contur is drawn, otherwise a 3D plot is drawn. Default: TRUE

xlab

String, title of the x axis. Default: "X", see plot() function

ylab

String, title of the y axis. Default: "Y", see plot() function

main

string, the same as "main" in plot() function

xlim

see plot() function

ylim

see plot() function

Legendlab_ggplot

String, in case of Plotter="ggplot" label for the legend. Default: "value"

...

Density specifc parameters, for PDEscatter() or SDH (nbins,lambda,Xkernels,Ykernel))

Details

Example shows that features with high correlation coefficient do not correlate because of bimodality.

Value

plotting handler

Author(s)

Michael Thrun

References

[Thrun/Ultsch, 2018] Thrun, M. C., & Ultsch, A. : Effects of the payout system of income taxes to municipalities in Germany, in Papiez, M. & Smiech,, S. (eds.), Proc. 12th Professor Aleksander Zelias International Conference on Modelling and Forecasting of Socio-Economic Phenomena, pp. 533-542, Cracow: Foundation of the Cracow University of Economics, Cracow, Poland, 2018.

See Also

DensityScatter

Examples

data(ITS)
data(MTY)
Inds=which(ITS<900&MTY<8000)

InspectCorrelation(ITS[Inds],MTY[Inds])


Mthrun/DataVisualizations documentation built on Jan. 16, 2024, 1:01 a.m.