Skip to contents

embedding spatial cross sectional data

Usage

# S4 method for class 'sf'
embedded(data, target, E = 3, tau = 1, nb = NULL, trend.rm = FALSE)

# S4 method for class 'SpatRaster'
embedded(data, target, E = 3, tau = 1, trend.rm = FALSE)

Arguments

data

The observation data.

target

Name of target variable.

E

(optional) Dimensions of the embedding.

tau

(optional) Step of spatial lags.

nb

(optional) The neighbours list.

trend.rm

(optional) Whether to remove the linear trend.

Value

A matrix

Examples

columbus = sf::read_sf(system.file("case/columbus.gpkg", package="spEDM"))
v = embedded(columbus,"crime")
v[1:5,]
#>          [,1]     [,2]     [,3]
#> [1,] 24.71427 41.55964 43.45135
#> [2,] 26.24684 44.57868 40.73529
#> [3,] 29.41175 43.45135 37.55683
#> [4,] 34.64648 37.95647 38.69064
#> [5,] 40.46533 34.43484 42.28334

cu = terra::rast(system.file("case/cu.tif", package="spEDM"))
r = embedded(cu,"cu")
r[1:5,]
#>          [,1]     [,2]     [,3]
#> [1,] 14.13616 13.86900 13.60871
#> [2,] 14.09866 13.59174 13.77765
#> [3,] 13.57425 13.91658 14.02535
#> [4,] 13.61885 13.81650 14.26563
#> [5,] 13.82547 13.76455 14.03200