Skip to content

Commit

Permalink
♻️ Rename function to compute epanechnikov
Browse files Browse the repository at this point in the history
  • Loading branch information
NONONOexe committed Sep 7, 2024
1 parent 94e1521 commit cfc0882
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 36 deletions.
2 changes: 1 addition & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ S3method(split_linestring,sfc_LINESTRING)
S3method(summary,road_network)
S3method(summary,segmented_network)
export(assign_event_to_link)
export(calculate_weights_epanechnikov)
export(compute_epanechnikov)
export(create_bbox)
export(create_coordinates)
export(create_graph)
Expand Down
14 changes: 6 additions & 8 deletions R/calculate-weights-epanechnikov.R → R/compute-epanechnikov.R
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
#' Epanechnikov kernel
#' Compute the Epanechnikov function
#'
#' The kernel is one of the quadratic kernels used
#' in kernel density estimation.
#'
#' Epanechnikov kernel is defined as follows:
#' The Epanechnikov function is one of the quadratic kernels used in
#' kernel density estimation. It is defined as follows:
#' \deqn{K(x) = \frac{3}{4}(1 - x^2) \quad \text{if} \quad |x| \leq 1\text{.}}
#'
#' @param x A numeric vector.
#' @return A numeric vector of weights of the kernel for each input points.
#' @export
#' @examples
#' x <- seq(-3, 3, 0.1)
#' y <- calculate_weights_epanechnikov(x)
#' plot(x, y, type = "l")
calculate_weights_epanechnikov <- function(x) {
#' y <- compute_epanechnikov(x)
#' plot(x, y, xlim = c(-3, 3), ylim = c(0, 1), type = "l")
compute_epanechnikov <- function(x) {
return(ifelse(abs(x) <= 1, (3 / 4) * (1 - x^2), 0))
}
27 changes: 0 additions & 27 deletions man/calculate_weights_epanechnikov.Rd

This file was deleted.

24 changes: 24 additions & 0 deletions man/compute_epanechnikov.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pkgdown/_pkgdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ url: https://nononoexe.github.io/pavement/

template:
bootstrap: 5
math-rendering: katex
light-switch: true
theme: gruvbox-light
theme-dark: gruvbox-dark
Expand Down

0 comments on commit cfc0882

Please sign in to comment.