loop_havok: Hankel Alternative View of Koopman (HAVOK) Analysis

View source: R/loop_havok.R

loop_havokR Documentation

Hankel Alternative View of Koopman (HAVOK) Analysis

Description

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.

Usage

loop_havok(
  stackmax,
  xdat = xdat,
  dt = dt,
  rstackmax = rstackmax,
  sparsify = sparsify,
  sparserandom = sparserandom,
  loops = loops,
  devMethod = devMethod,
  gllaEmbed = gllaEmbed,
  alignSVD = alignSVD,
  center = TRUE,
  polyOrder = 1,
  useSine = FALSE,
  discrete = FALSE
)

Arguments

stackmax

An integer; number of shift-stacked rows.

xdat

A vector of equally spaced measurements over time.

dt

A numeric value indicating the time-lag between two subsequent time series measurements.

rstackmax

ADD

sparsify

ADD

sparserandom

ADD

loops

ADD

devMethod

A character string; One of either "FOCD" for fourth order central difference or "GLLA" for generalized local linear approximation.

gllaEmbed

An integer; the embedding dimension used for devMethod = "GLLA".

alignSVD

Logical; Whether the singular vectors should be aligned with the data.

center

Logical; should xdat be centered around 0?

polyOrder

NEED CLEANED

useSine

NEED CLEANED

discrete

Logical; is the underlying system discrete?

Value

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

References

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.

Examples

## 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,
            rmax = 5, polyOrder = 1, useSine = FALSE)
plot(hav)

## End(Not run)

RobertGM111/havok documentation built on July 8, 2023, 8:23 p.m.