extended_lnlp: Perform regularized S-map using a generalized function

View source: R/extended_SSR.R

extended_lnlpR Documentation

Perform regularized S-map using a generalized function

Description

extended_lnlp performs the regularized S-map introduced in Censi et al. (2019) Methods in Ecology and Evolution. Multivariate S-map is also supported.

Usage

extended_lnlp(
  block_time,
  lib = c(1, NROW(block_time)),
  pred = lib,
  tp = 1,
  target_column = 1,
  lib_column = 1:NCOL(block_time),
  num_neighbors = NCOL(block_time) + 1,
  theta = 0,
  dist_w = NULL,
  regularized = FALSE,
  lambda = NULL,
  alpha = 0,
  glmnet_parallel = FALSE,
  random_seed = NULL,
  save_smap_coefficients = FALSE
)

Arguments

block_time

Dataframe or matrix. Original time series.

lib

Numeric vector. Library indices.

pred

Numeric vector. Prediction indices.

tp

Forecasting time ahead.

target_column

Numeric. Indicates target column

lib_column

Numeric. Indicates library column

num_neighbors

Numeric. The number of nearest neighbors.

theta

Numeric. Weighing function for S-map.

dist_w

Matrix. Distance matrix used to calculate weights for S-map. Implemented for MDR S-map (Chang et al. 2021) Ecology Letters. If NULL, then weights are calculated based on Euclidean distance.

regularized

Logical If TRUE, regularized S-map will be performed. If FALSE, the normal S-map will be performed. Please use rEDM::s_map function.

lambda

Numeric. Specify the strength of penalty in the regularization.

alpha

Numeric. alpha = 0 is the ridge regression, alpha = 1 is the lasso regression, and ⁠0 < alpha < 1⁠ is an elastic net.

glmnet_parallel

Logical. If TRUE, the computation will be parallel (currently, experimental).

random_seed

Numeric. Random seed.

save_smap_coefficients

Logical. If TRUE, S-map coefficients will be saved.

Details

  • Cenci, S, Sugihara, G, Saavedra, S. Regularized S-map for inference and forecasting with noisy ecological time series. Methods Ecol Evol. 2019; 10: 650– 660. https://doi.org/10.1111/2041-210X.13150

Value

A list containing:

model_output Model predictions
stats Statistics.
smap_coefficients S-map coefficients

Examples

# extended_lnlp()

ong8181/macam documentation built on April 11, 2024, 12:58 p.m.