nkde_worker_bw_sel: Bandwidth selection by likelihood cross validation worker...

View source: R/bandwidth_selection_cv_sf.R

nkde_worker_bw_selR Documentation

Bandwidth selection by likelihood cross validation worker function

Description

worker function for calculating for multiple bandwidth the cross validation likelihood to select an appropriate bandwidth in a data-driven approach

Usage

nkde_worker_bw_sel(
  lines,
  quad_events,
  events_loc,
  events,
  w,
  kernel_name,
  bws_net,
  method,
  div,
  digits,
  tol,
  sparse,
  max_depth,
  zero_strat = "min_double",
  verbose = FALSE,
  cvl = FALSE
)

Arguments

lines

A feature collection of linestrings representing the underlying network

quad_events

a feature collection of points indicating for which events the densities must be calculated

events_loc

A feature collection of points representing the location of the events

events

A feature collection of points representing the events. Multiple events can share the same location. They are linked by the goid column

w

A numeric matrix with the weight of the events for each bandwdith

kernel_name

The name of the kernel to use (string)

bws_net

A numeric matrix with the network bandwidths for each event

method

The type of NKDE to use (string)

digits

The number of digits to retain from the spatial coordinates. It ensures that topology is good when building the network. Default is 3. Too high a precision (high number of digits) might break some connections

tol

A float indicating the minimum distance between the events and the lines' extremities when adding the point to the network. When points are closer, they are added at the extremity of the lines.

sparse

A Boolean indicating if sparse or regular matrices should be used by the Rcpp functions. These matrices are used to store edge indices between two nodes in a graph. Regular matrices are faster, but require more memory, in particular with multiprocessing. Sparse matrices are slower (a bit), but require much less memory.

zero_strat

A string indicating what to do when density is 0 when calculating LOO density estimate for an isolated event. "min_double" (default) replace the 0 value by the minimum double possible on the machine. "remove" will remove them from the final score. The first approach penalizes more strongly the small bandwidths.

verbose

A boolean

cvl

A boolean indicating if the cvl method (TRUE) or the loo (FALSE) method must be used

Examples

# no example provided, this is an internal function

spNetwork documentation built on June 22, 2024, 9:40 a.m.