SmoothedDensitiesXY: Smoothed Densities X with Y

SmoothedDensitiesXYR Documentation

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,

Compute="Cpp", PlotIt = FALSE)

Arguments

X

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

Y

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

nbins

Optional, number of bins, default is 250, if scalar nbins=nx=ny otherwise c(nx,ny) vector of length 2

lambda

Optional, smoothing factor used by the density estimator, default is lambda = 20

Xkernels

Optional, bin kernels in x direction are given, if not set nx bins in range of data are generated with seq

Ykernels

Optional, bin kernels y direction are given, if not set ny bins in range of data are generated with seq

Compute

Either R, Cpp or Parallel, defines how the heavy-load computation is performed

PlotIt

FALSE: no plotting, TRUE: simple plot

Details

lambda has to chosen by the user and is a sensitive parameter and a lambda = 20 roughly means that the smoothing is over 20 bins around a given point.

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

GridDensity

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

Points2GridInd

an index such that Densities = GridDensity[Points2GridInd]

Author(s)

Michael Thrun

References

[Eilers/Goeman, 2004] Eilers, P. H., & Goeman, J. J.: Enhancing scatterplots with smoothed densities, Bioinformatics, Vol. 20(5), pp. 623-628.DOI: \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1093/bioinformatics/btg454")}, 2004.

Examples





if(requireNamespace("DataVisualizations")){
data("ITS",package = "DataVisualizations")
data("MTY",package = "DataVisualizations")
Inds=which(ITS<900&MTY<8000)
V=SmoothedDensitiesXY(ITS[Inds],MTY[Inds])
}else{
#sample random data
ITS=rnorm(1000)
MTY=rnorm(1000)
V=SmoothedDensitiesXY(ITS,MTY)
}



ScatterDensity documentation built on April 15, 2025, 5:09 p.m.