Learn R Programming

rinform (version 1.0.2)

info_flow: Information Flow

Description

Compute the information flow from lsrc time series src to another ldst time series dst. Optionally, the user can specify lback background time series back to conditioning probabilities.

Usage

info_flow(src, dst, back = NULL, lsrc, ldst, lback = 0)

Arguments

src

Vector or matrix specifying one or more source time series.

dst

Vector or matrix specifying one or more destination time series.

back

Vector or matrix specifying one or more background time series.

lsrc

Integer giving the number of sources.

ldst

Integer giving the number of destinations.

lback

Integer giving the number of backgrounds.

Value

Numeric giving the value of information flow.

Examples

Run this code
# NOT RUN {
# Information flow across four time series:
ws <- c(0, 0, 1, 0, 1, 1, 0, 1)
xs <- c(0, 0, 1, 0, 1, 1, 0, 1)
ys <- c(0, 0, 1, 0, 1, 1, 0, 1)
zs <- c(0, 0, 0, 0, 0, 0, 0, 0)

info_flow(src = xs, dst = ys, lsrc = 1, ldst = 1)                            # flow ~ 1.0
info_flow(src = xs, dst = ys, back = ws, lsrc = 1, ldst = 1, lback = 1)      # flow ~ 0.0
info_flow(src = ws, dst = zs, back = ys, lsrc = 1, ldst = 1, lback = 1)      # flow ~ 0.0

# Now let's intervene on ys and zs
ws <- c(0, 0, 1, 0, 1, 1, 0, 1)
xs <- c(0, 0, 1, 0, 1, 1, 0, 1)
ys <- c(1, 0, 1, 0, 0, 1, 1, 0)
zs <- c(1, 0, 0, 0, 1, 0, 1, 1)
info_flow(src = xs, dst = ys, lsrc = 1, ldst = 1)                            # flow ~ 0.0
info_flow(src = xs, dst = ys, back = ws, lsrc = 1, ldst = 1, lback = 1)      # flow ~ 0.0
info_flow(src = ws, dst = zs, back = ys, lsrc = 1, ldst = 1, lback = 1)      # flow ~ 1.0
# }

Run the code above in your browser using DataLab