knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "man/figures/README-", out.width = "100%" ) library(nonlinearTseries)
Tangle is a means of quantifying complexity in relatively short time series data.
You can install a development version of Tangle from github with:
library(devtools) install_github("RobertGM111/Tangle") library(Tangle)
Tangle algorithm in process: (a) 0 iterations, (b) 500 iterations, and (c) 10,000 iterations.
par(mai=c(.1,.1,.2,.1)) par(mfrow=c(1,3)) #XP <- read.csv("~/Documents/APS2016/XP.csv") XP <- lorenz(time = seq(0,100,.01), do.plot = FALSE) # tau.ami = timeLag(XP$x, technique = "ami", # lag.max = 100, do.plot = FALSE) # emb.dim = estimateEmbeddingDim(XP$x, time.lag = tau.ami, # max.embedding.dim = 15,do.plot = FALSE) tak = cbind(XP$x,XP$y,XP$z) plot(x=NULL, y=NULL, type="n", xlab=NA, ylab=NA, xlim=c(-3, 3), ylim=c(-3, 3),frame=FALSE,main="a", xaxt='n', yaxt='n') lines(scale(XP$x), scale(XP$z), col=rgb(0,0,0,.8),lwd=1) XP <- lorenz(time = seq(0,100,.05), do.plot = FALSE) # tau.ami = timeLag(XP$x, technique = "ami", # lag.max = 100, do.plot = FALSE) # emb.dim = estimateEmbeddingDim(XP$x, time.lag = tau.ami, # max.embedding.dim = 15,do.plot = FALSE) tak = cbind(XP$x,XP$y,XP$z) N<-nrow(tak)# Number of samples S<-diag(N) # Generate "upshift" matrix S<-S[,c(dim(S)[2],(1:(dim(S)[2]-1)))] W<-((diag(N)+S)/2)# Generate Updating matrix for (i in 1:500){ tak <- W%*%tak tak <- scale(tak) } plot(x=NULL, y=NULL, type="n", xlab=NA, ylab=NA, xlim=c(-3, 3), ylim=c(-3, 3),frame=FALSE,main="b", xaxt='n', yaxt='n') lines(scale(tak[,1]), scale(tak[,3]), col=rgb(0,0,0,.8),lwd=1) for (i in 1:10000){ tak <- W%*%tak tak <- scale(tak) } plot(x=NULL, y=NULL, type="n", xlab=NA, ylab=NA, xlim=c(-3, 3), ylim=c(-3, 3),frame=FALSE,main="c", xaxt='n', yaxt='n') lines(scale(tak[,1]), scale(tak[,3]), col=rgb(0,0,0,.8),lwd=1)
Example use of tangle on a simulated time series
# Generate data from Lorenz attractor library(nonlinearTseries) lorTS <- lorenz(do.plot = FALSE)$x # Downsample for example speed samps <- seq(1, length(lorTS), length.out = 500) lorTS <- lorTS[samps] # Estimate tau lorTau <- timeLag(lorTS) # Calculate Tangle tangle(lorTS, tau = lorTau)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.