havok | R Documentation |
Data-driven decomposition of chaotic time series into an intermittently forced linear system. HAVOK combines delay embedding and Koopman theory to decompose chaotic dynamics into a linear model in the leading delay coordinates with forcing by low-energy delay coordinates. Forcing activity demarcates coherent phase space regions where the dynamics are approximately linear from those that are strongly nonlinear.
havok(xdat, dt = 1, stackmax = 100, lambda = 0, loops = 1,
lambda_increase = FALSE, center = TRUE,
rmax = 15, rset = NA, rout = NA,
polyOrder = 1, useSine = FALSE,
discrete = FALSE, devMethod = c("FOCD", "GLLA"),
gllaEmbed = NA, alignSVD = TRUE)
xdat |
A vector of equally spaced measurements over time. |
dt |
A numeric value indicating the time-lag between two subsequent time series measurements. |
stackmax |
An integer; number of shift-stacked rows. |
lambda |
A numeric value; sparsification threshold. |
lambda_increase |
Logical; should the sparsification threshold be multiplied by the sparsified column index? |
center |
Logical; should |
rmax |
An integer; maximum number of singular vectors to include. |
rset |
An integer; specific number of singular vectors to include. |
rout |
An integer or vector of integers; excludes columns of singular values from analysis. |
polyOrder |
An integer from 0 to 5; if useSINDy = TRUE, the highest degree of polynomials included in the matrix of candidate functions. |
useSine |
Logical; should sine and cosine functions of variables be added to the library of potential candidate functions? If TRUE, candidate function matrix is augmented with sine and cosine functions of integer multiples 1 through 10. |
discrete |
Logical; is the underlying system discrete? |
devMethod |
A character string; One of either |
gllaEmbed |
An integer; the embedding dimension used for |
alignSVD |
Logical; Whether the singular vectors should be aligned with the data. |
An object of class 'havok' with the following components:
havokSS
- A HAVOK analysis generated state space model with its time history.
params
- A matrix of parameter values used for this function.
dVrdt
- A matrix of first order derivatives of the reduced rank V matrix with respect to time.
r
- Estimated optimal number singular vectors to include in analysis.
sys
- HAVOK model represented in state-space form.
normTheta
- Normalized matrix of candidate functions obtained from pool_data
.
Xi
- A matrix of sparse coefficients obtained from sparsify_dynamics
.
Vr
- The reduced rank V matrix of the SVD of the Hankel matrix of the time series.
Ur
- The reduced rank U matrix of the SVD of the Hankel matrix of the time series.
sigsr
- Values of the diagonal of the reduced rank \Sigma
matrix of the SVD of the Hankel matrix of the time series.
Vr_aligned
- Vr truncated based upon devMethod
R2 - |
Squared correlation between the model predicted v_1 and v_1 exracted from SVD. A model fit estimate. |
S. L. Brunton, B. W. Brunton, J. L. Proctor, E. Kaiser, and J. N. Kutz, "Chaos as an intermittently forced linear system," Nature Communications, 8(19):1-9, 2017.
## Not run:
#Lorenz Attractor
#Generate Data
##Set Lorenz Parameters
parameters <- c(s = 10, r = 28, b = 8/3)
n <- 3
state <- c(X = -8, Y = 8, Z =27) ##Inital Values
#Intergrate
dt <- 0.001
tspan <- seq(dt, 200, dt)
N <- length(tspan)
Lorenz <- function(t, state, parameters) {
with(as.list(c(state, parameters)), {
dX <- s * (Y - X)
dY <- X * (r - Z) - Y
dZ <- X * Y - b * Z
list(c(dX, dY, dZ))
})
}
out <- ode(y = state, times = tspan, func = Lorenz, parms = parameters, rtol = 1e-12, atol = 1e-12)
xdat <- out[, "X"]
hav <- havok(xdat = xdat, dt = dt, stackmax = 100, lambda = 0,
rmax = 15, polyOrder = 1, useSine = FALSE)
# ECG Example
data(ECG_measurements)
xdat <- ECG_measurements[,"channel1"]
dt <- ECG_measurements[2,"time"] - ECG_measurements[1,"time"]
stackmax <- 25
rmax <- 5
lambda <- .001
hav <- havok(xdat = xdat, dt = dt, stackmax = stackmax, lambda = lambda,
lambda_increase = TRUE, loops = 10, rmax = 5, polyOrder = 1, useSine = FALSE)
plot(hav)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.