smap forecasting
Usage
# S4 method for class 'sf'
smap(
data,
target,
lib,
pred = lib,
E = 3,
tau = 1,
k = 4,
theta = c(0, 1e-04, 3e-04, 0.001, 0.003, 0.01, 0.03, 0.1, 0.3, 0.5, 0.75, 1, 1.5, 2, 3,
4, 6, 8),
nb = NULL,
threads = detectThreads(),
trend.rm = TRUE
)
# S4 method for class 'SpatRaster'
smap(
data,
target,
lib,
pred = lib,
E = 3,
tau = 1,
k = 4,
theta = c(0, 1e-04, 3e-04, 0.001, 0.003, 0.01, 0.03, 0.1, 0.3, 0.5, 0.75, 1, 1.5, 2, 3,
4, 6, 8),
threads = detectThreads(),
trend.rm = TRUE
)
Arguments
- data
The observation data.
- target
Name of target variable.
- lib
Row numbers(
vector
) of lattice data or row-column numbers(matrix
) of grid data for creating the library from observations.- pred
(optional) Row numbers(
vector
) of lattice data or row-column numbers(matrix
) of grid data used for predictions.- E
(optional) Dimensions of the embedding.
- tau
(optional) Step of spatial lags.
- k
(optional) Number of nearest neighbors to use for prediction.
- theta
(optional) Weighting parameter for distances
- nb
(optional) The neighbours list.
- threads
(optional) Number of threads.
- trend.rm
(optional) Whether to remove the linear trend.
Examples
columbus = sf::read_sf(system.file("shapes/columbus.gpkg", package="spData"))
# \donttest{
smap(columbus,target = "INC",lib = 1:49)
#> The suggested theta for variable INC is 8
#> theta rho mae rmse
#> [1,] 0.0000 -0.01677569 87.28026 301.3538
#> [2,] 0.0001 -0.01677581 87.28042 301.3546
#> [3,] 0.0003 -0.01677605 87.28073 301.3562
#> [4,] 0.0010 -0.01677689 87.28182 301.3618
#> [5,] 0.0030 -0.01677928 87.28493 301.3778
#> [6,] 0.0100 -0.01678759 87.29580 301.4335
#> [7,] 0.0300 -0.01681079 87.32671 301.5927
#> [8,] 0.1000 -0.01706041 87.53217 302.1522
#> [9,] 0.3000 -0.01722288 87.80006 303.7144
#> [10,] 0.5000 -0.01718827 88.01756 305.2364
#> [11,] 0.7500 -0.01731426 88.39731 307.0872
#> [12,] 1.0000 -0.01740398 88.76569 308.8671
#> [13,] 1.5000 -0.02062485 89.97208 312.2235
#> [14,] 2.0000 -0.02279413 89.64727 315.0630
#> [15,] 3.0000 -0.01883577 91.38497 320.1625
#> [16,] 4.0000 -0.01736336 92.44264 323.8490
#> [17,] 6.0000 -0.01984894 92.85440 328.2862
#> [18,] 8.0000 -0.01513727 93.27553 330.2034
# }