Title: | Nonlinear Vector Autoregression Models |
Version: | 0.1.0 |
Description: | Estimate nonlinear vector autoregression models (also known as the next generation reservoir computing) for nonlinear dynamic systems. The algorithm was described by Gauthier et al. (2021) <doi:10.1038/s41467-021-25801-2>. |
License: | GPL (≥ 3) |
Encoding: | UTF-8 |
RoxygenNote: | 7.2.3 |
Imports: | dplyr, magrittr, purrr, rlang, stats, tibble, tidyr |
Suggests: | ggplot2, nonlinearTseries, testthat (≥ 3.0.0) |
Config/testthat/edition: | 3 |
URL: | https://github.com/Sciurus365/NVAR |
BugReports: | https://github.com/Sciurus365/NVAR/issues |
NeedsCompilation: | no |
Packaged: | 2024-01-18 09:43:11 UTC; jingm |
Author: | Jingmeng Cui |
Maintainer: | Jingmeng Cui <jingmeng.cui@outlook.com> |
Repository: | CRAN |
Date/Publication: | 2024-01-18 11:30:02 UTC |
Pipe operator
Description
See magrittr::%>%
for details.
Usage
lhs %>% rhs
Arguments
lhs |
A value or the magrittr placeholder. |
rhs |
A function call using the magrittr semantics. |
Value
The result of calling rhs(lhs)
.
Fit a nonlinear vector autoregression model
Description
Described by Gauthier et al. (2021), also known as the "next generation reservoir computing" (NG-RC).
Usage
NVAR(data, vars, s, k, p, constant = TRUE, alpha = 0.05)
Arguments
data |
A |
vars |
A character vector of the variable names used in the model. |
s |
The number of time steps skipped between each two used time steps. |
k |
The number of time steps used for constructing features. |
p |
The order of polynomial feature vector. |
constant |
Whether there should be a constant value (1) in the feature set? Default is |
alpha |
The |
Details
The feature vector is as follows (from the reference):
\mathbb{O}_{\text {total }}=\mathbb{O}_{\text {lin }} \oplus \mathbb{O}_{\text {nonlinear }}^{(p)}
\mathbb{O}_{\operatorname{lin}, i}=\mathbf{X}_i \oplus \mathbf{X}_{i-s} \oplus \mathbf{X}_{i-2 s} \oplus \ldots \oplus \mathbf{X}_{i-(k-1) s}
\mathbb{O}_{\text {nonlinear }}^{(p)}=\mathbb{O}_{\text {lin }}\lceil\otimes\rceil \mathbb{O}_{\text {lin }}\lceil\otimes\rceil \ldots\lceil\otimes\rceil \mathbb{O}_{\text {lin }}
The feature vector \mathbb{O}_{\text {total }}
is then used as input for a ridge regression with alpha
.
Value
An NVAR
object that contains data
, data_td
(a tidy form of tibble
that contains the training data), W_out
(the fitted coefficients), and parameters
.
References
Gauthier, D. J., Bollt, E., Griffith, A., & Barbosa, W. A. S. (2021). Next generation reservoir computing. Nature Communications, 12(1), 5564. https://doi.org/10.1038/s41467-021-25801-2
See Also
sim_NVAR()
for simulating the NVAR model.
Examples
# generate test data from the Lorenz system
testdata <- nonlinearTseries::lorenz()
testdata <- tibble::as_tibble(testdata)
# fit an NVAR model for the Lorenz system
t1 <- NVAR(data = testdata, vars = c("x", "y", "z"), s = 2, k = 2, p = 2, alpha = 1e-3)
# simulate the NVAR model
t1_sim <- sim_NVAR(t1, length = 5000)
# (also see README for the plots of the results and the comparison with the true model)
Time series simulation with an NVAR model
Description
Time series simulation with an NVAR model
Usage
sim_NVAR(
model,
init = NULL,
length = 1000,
noise = 0,
upper_lim = Inf,
lower_lim = -Inf
)
Arguments
model |
An |
init |
A |
length |
How many time steps should be simulated? |
noise |
A number indicating the standard deviation of the Gaussian noise
added to each time step. |
upper_lim , lower_lim |
The upper and lower limit for the simulation. Once the simulated value is out of the limits, it will be taken back to avoid instability of the simulation. Both should either be a single number or a numeric vector with the same length as the number of variables in the model. |
Value
A tibble
with the simulated time series.