Learn R Programming

DataVisualizations (version 1.2.3)

SmoothedDensitiesXY: Smoothed Densities X with Y

Description

Density is the smothed histogram density at [X,Y] of [Eilers/Goeman, 2004]

Usage

SmoothedDensitiesXY(X, Y, nbins, lambda, Xkernels, Ykernels, PlotIt = FALSE)

Value

List of:

Densities

numeric vector [1:n] is the smothed density in 3D

Xkernels

numeric vector [1:nx], nx defined by nbins, such that mesh(Xkernels,Ykernels,F) form the ( not NaN) smothed densisties

Ykernels

numeric vector [1:ny], nx defined by nbins, such that mesh(Xkernels,Ykernels,F) form the ( not NaN) smothed densisties

hist_F_2D

matrix [1:nx,1:ny] beeing the smoothed 2D histogram

ind

an index such that Densities = hist_F_2D[ind]

Arguments

X

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

Y

Numeric vector [1:n], second feature (for y axis values), nbins= nxy => the nr of bins in x and y is nxy nbins = c(nx,ny) => the nr of bins in x is nx and for y is ny

nbins

number of bins, nbins =200 (default)

lambda

smoothing factor used by the density estimator or c() default: lambda = 20 which roughly means that the smoothing is over 20 bins around a given point.

Xkernels

bin kernels in x direction are given

Ykernels

bin kernels y direction are given

PlotIt

FALSE: no plotting, TRUE: simple plot

Author

Michael Thrun, reimplemented from Matlab (Alfred Ultsch)

Details

lambda has to chosen by the user and is a sensitive parameter.

References

[Eilers/Goeman, 2004] Eilers, P. H., & Goeman, J. J.: Enhancing scatterplots with smoothed densities, Bioinformatics, Vol. 20(5), pp. 623-628. 2004.

See Also

DensityScatter

Examples

Run this code
data("ITS")
data("MTY")
Inds=which(ITS<900&MTY<8000)
V=SmoothedDensitiesXY(ITS[Inds],MTY[Inds])

Run the code above in your browser using DataLab