Skip to contents

false nearest neighbours

Usage

# S4 method for class 'sf'
fnn(
  data,
  target,
  lib = NULL,
  pred = NULL,
  E = 1:10,
  tau = 1,
  nb = NULL,
  rt = 10,
  eps = 2,
  threads = detectThreads(),
  trend.rm = TRUE
)

# S4 method for class 'SpatRaster'
fnn(
  data,
  target,
  lib = NULL,
  pred = NULL,
  E = 1:10,
  tau = 1,
  rt = 10,
  eps = 2,
  threads = detectThreads(),
  trend.rm = TRUE
)

Arguments

data

The observation data.

target

Name of target variable.

lib

(optional) Libraries indices.

pred

(optional) Predictions indices.

E

(optional) Dimensions of the embedding.

tau

(optional) Step of spatial lags.

nb

(optional) The neighbours list.

rt

(optional) escape factor.

eps

(optional) neighborhood diameter.

threads

(optional) Number of threads.

trend.rm

(optional) Whether to remove the linear trend.

Value

A vector

References

Kennel M. B., Brown R. and Abarbanel H. D. I., Determining embedding dimension for phase-space reconstruction using a geometrical construction, Phys. Rev. A, Volume 45, 3403 (1992).

Examples

columbus = sf::read_sf(system.file("case/columbus.gpkg", package="spEDM"))
# \donttest{
fnn(columbus,"crime")
#>        E:1        E:2        E:3        E:4        E:5        E:6        E:7 
#> 0.79591837 0.53061224 0.63265306 0.51020408 0.12244898 0.04081633 0.00000000 
#>        E:8 
#> 0.00000000 
# }