Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation Additions to kde #28

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions R/kde.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,23 @@
#'@title kde
#'
#'@param X an n by d matrix of coordinates used in kernel density estimation
#'where n is the number of points and d is the dimension
#'
#'@param Grid an m by d matrix of coordinates where m is the number of points and d
#'is the dimension of the base grid referred to in the estimation
#'
#'@param h a desired number to be used as the smoothing parameter of the Gaussian Kernel
#'
#'@param kertype set by default to to use Gaussian kernel
#'
#'@param weight set by default to 1, making all points in X weighted the same unless
#'otherwise specified
#'
#'@return vector of length m (the number of points in the grid) containing the value of
#'the kernel density estimator for each point in the grid

kde <-
function(X, Grid, h, kertype = "Gaussian", weight = 1, printProgress = FALSE) {

if (!is.numeric(X) && !is.data.frame(X)) {
stop("X should be a matrix of coordinates")
}
Expand All @@ -26,7 +43,6 @@ function(X, Grid, h, kertype = "Gaussian", weight = 1, printProgress = FALSE) {
if (!is.logical(printProgress)) {
stop("printProgress should be a logical variable")
}

return (Kde(X = as.matrix(X), Grid = as.matrix(Grid), h = h,
kertype = kertype, weight = weight, printProgress = printProgress))
}