Learn R Programming

UPMASK (version 1.2)

kde2dForSubset: Compute the density based distance quantity using a 2D Kernel Density Estimation

Description

kde2dForSubset will compute the 2D Kernel Density Estimation for the requested subset of data and will return the quantiy (max(d)-mean(d))/sd(d) if the option returnDistance is set to TRUE.

Usage

kde2dForSubset(df, setw=1, n=50, showStats=TRUE, printPlots=TRUE, 
returnDistance=FALSE, positionDataIndexes=c(1,2))

Arguments

df

a data frame to use

setw

an integer with the class of the stars to perform the analysis

n

the number of points in the regular grid of the density estimation

showStats

a boolean indicating if the user wants to see output statistics

printPlots

a boolean indicating if the user wants to see plots

returnDistance

a boolean indicating if the distance between the max and the mean in units of standard deviations should be returned

positionDataIndexes

an array of integers indicating the columns of the file containing the spatial position measurements

Value

A double representing the density based distance quantity.

References

Krone-Martins, A. & Moitinho, A., A&A, v.561, p.A57, 2014

Examples

Run this code
# NOT RUN {
# Create a simple data set with the values and errors
toyDataDF <- data.frame(x=runif(50, 0, 10), y=runif(50, 0, 10), resMclust.class=rep(1, 50))

# Run the KDE 2D analysis for the required subset
disV <- kde2dForSubset(toyDataDF, showStats=FALSE, printPlots=FALSE, returnDistance=TRUE)

# Clean the environment
rm(list=c("toyDataDF", "disV"))
 
# }

Run the code above in your browser using DataLab