dc_win: Dynamic Complexity

View source: R/dc.R

dc_winR Documentation

Dynamic Complexity

Description

Calculates Dynamic Complexity, a complexity index for short and coarse grained time series.

Usage

dc_win(
  df,
  win = 0,
  scale_min,
  scale_max,
  doPlot = FALSE,
  doPlotF = FALSE,
  doPlotD = FALSE,
  returnFandD = FALSE,
  useVarNames = TRUE,
  colOrder = TRUE,
  useTimeVector = NA,
  timeStamp = "31-01-1999",
  markID = NA,
  markIDcolour = "grey",
  markIDlabel = "Time points of interest marked grey",
  markIDalpha = 0.5,
  NAdates = 1:(win - 1),
  trimFirstWin = TRUE
)

Arguments

df

A data frame containing multivariate time series data from 1 person. Rows should indicate time, columns should indicate the time series variables. All time series in df should be on the same scale, an error will be thrown if the range of the time series indf is not ⁠[scale_min,scale_max]⁠.

win

Size of window in which to calculate Dynamic Complexity. If win < NROW(df) the window will move along the time series with a stepsize of 1 (default = NROW(df))

scale_min

The theoretical minimum value of the scale. Used to calculate expected values, so it is important to set this to the correct value.

scale_max

The theoretical maximum value of the scale. Used to calculate expected values, so it is important to set this to the correct value.

doPlot

If TRUE shows a Complexity Resonance Diagram of the Dynamic Complexity and returns an invisible ggplot2::ggplot() object. (default = FALSE)

doPlotF

If TRUE shows a Complexity Resonance Diagram of the Fluctuation Intensity and returns an invisible ggplot2::ggplot() object. (default = FALSE)

doPlotD

If TRUE shows a Complexity Resonance Diagram of the Distribution Uniformity and returns an invisible ggplot2::ggplot() object. (default = FALSE)

returnFandD

Returns a list object containing the dynamic complexity series as well as the F and D series. (default = FALSE)

useVarNames

Use the column names of df as variable names in the Complexity Resonance Diagram (default = TRUE)

colOrder

If TRUE, the order of the columns in df determines the of variables on the y-axis. Use FALSE for alphabetic/numeric order. Use NA to sort by by mean value of Dynamic Complexity (default = TRUE)

useTimeVector

Parameter used for plotting. A vector of length NROW(df), containing date/time information (default = NA)

timeStamp

If useTimeVector is not NA, a character string that can be passed to lubridate::stamp() to format the the dates/times passed in useTimeVector (default = "01-01-1999")

markID

Numeric vector of integers in the range ⁠[length of window, length of timeseries]⁠. Vertical lines will be drawn at these indices (default = NA)

markIDcolour

Colour of time point markers (default = "red")

markIDlabel

Label added to subtitle explaining time point markers (default = ⁠Time points of interest marked red⁠)

markIDalpha

Alpha of time point marker colour (default = .5)

NAdates

Should some dates be considered NA? Provide a numerical vector with indices, the default is to set 1:(win-1) to NA. (default = 1:(win-1))

trimFirstWin

Display the first empty window (1:win-1)? (default = TRUE)

plotMeanCD

Plot the mean Dynamic Complexity at the top row of the resonance diagram? (default = TRUE)

Value

If doPlot = TRUE, a list object containing a data frame of Dynamic Complexity values and a ggplot2 object of the dynamic complexity resonance diagram. If doPlot = FALSE the data frame with Dynamic Complexity series is returned.

Author(s)

Merlijn Olthof

Fred Hasselman

References

Haken H, & Schiepek G. (2006). Synergetik in der Psychologie. Selbstorganisation verstehen und gestalten. Hogrefe, Göttingen.

Schiepek, G. (2003). A Dynamic Systems Approach to Clinical Case Formulation. European Journal of Psychological Assessment, 19, 175-184. https://doi.org/10.1027//1015-5759.19.3.175

Schiepek, G., & Strunk, G. (2010). The identification of critical fluctuations and phase transitions in short term and coarse-grained time series-a method for the real-time monitoring of human change processes. Biological cybernetics, 102(3), 197-207. https://doi.org/10.1007/s00422-009-0362-1

See Also

Other Dynamic Complexity functions: dc_ccp(), dc_d(), dc_f(), plotDC_ccp(), plotDC_lvl(), plotDC_res()

Examples


 # Dynamic Complexity analysis on part of the coloured noise dataset:
 data(ColouredNoise)
 # Make unit scale
 df <- data.frame(Brownianish = elascer(rowSums(ColouredNoise[,1:6])), pinkish = elascer(rowSums(ColouredNoise[,7:12])), whiteish = elascer(rowSums(ColouredNoise[,12:17])))
 dc_win(df = df, win = 56, scale_min = 0, scale_max = 1, doPlot = TRUE)


FredHasselman/casnet documentation built on May 5, 2024, 9:38 p.m.