The Neurophysiological Biomarker Toolbox (NBT)

# Part I: Background and terminology

In this first part of the tutorial we will just give a bit of background on Vector Autoregressive Model (VAR) models, and how these models can be implemented in MATLAB.

### The dynamics.var class

You can create a VAR model and generate the corresponding model observations using class dynamics.var. Before reading the documentation of that class, be aware that class dynamics.var is considerably more complex than what is needed for this tutorial. Moreover, the documentation is addressing someone that is planning to use the class in his/her own programs, i.e. someone that is well versed in MATLAB and VAR models. This means that the documentation of the class can be difficult to understand. The good news is that (hopefully) the information in this tutorial documentation is enough for you to use the basic functionality of class dynamics.var, and to finnish the tutorial successfully.

### Basic VAR model

The dynamics.var class implements the machinery necessary for generating observations from a Vector Autoregressive Model (VAR):

where $s(t)=[s_1(t),...,s_d(t)]^{T}$ is the realization at time $t$ of the VAR observation vector, $B_{\tau}$ is the VAR coefficient matrix for lag $\tau$ and $h(t)=[h_1(t),...,h_d(t)]$ is the realization at time $t$ of the innovation process. The latter is assumed to be an independent and identically distributed (i.i.d.) random process.

##### From the lectures

It is important that you put the formula above in the context of the lecture dealing with methods for assessing information flow between EEG-sources. Recall from that lecture that the innovation process represents the \\intrinsic
activity generated at each EEG-source, i.e. whatever is truly unique to each source. In the master/slave clocks analogy that we used in the lecture the innovation process of each source would be the random noises that are generated at both master and slave and that introduce some random variations in the ticking patterns of the clocks.

Because we model the (mutually independent) intrinsic EEG-source activations using the innovation processes $h_1(t), h_2(t), ...$ we are implicitely imposing an extra requirement to the VAR model: that the _innovation processes_ are not only i.i.d. ($h_i(t)$ tells you nothing about $h_i(t \Delta)$ for any $\Delta\ne 0$) but also that they are _mutually independent_ (i.e. that $h_i(t)$ tells you nothing about $h_j(t \Delta)$ for any $\Delta$ and for any $j \ne i$).

##### Terminology from graph theory

We will often refer to the elements of vector $s(t)$ as the _nodes_ of the model. The term _nodes_ is used because each time-series $s_i(t)$ can be understood as the temporal activation pattern of a network node. Then, nodes may or may not be connected to each other by directional edges. I have borrowed this terminology from graph theory, which is becoming increasingly popular in Neuroscience and, especially, in functional connectivity analyses of neuroimaging data.

### The Innovations of the model

Typically, the innovation process of the VAR model above is considered to be a sequence of i.i.d. Gaussian random variables. However, class dynamics.var more generally models the innovation process with a Generalized Normal Distribution. The Generalized Normal Distribution is a family of probability distributions that includes, among others, the Laplace and the Normal distribution. However, in this tutorial we will only use normally distributed innovations.

### The topology of the network

A useful property of of any network consisting of multiple nodes is its Topology. The topology of a network describes the way network nodes are connected to each other. That is, it describes the pattern of \\network edges
. In the case of a VAR model (implemented by our dynamics.var class) the Topology property describes how the nodes of the model, the s_i(t), send or receive information from/to other nodes. The topology of a dynamics.var object can be specified when you construct the object:

obj = var('NbDims', 3, 'Topology', 'tree');

which will create a dynamics.var object having 3 nodes and with a tree topology. You can also modify the topology of the object later, using modifier method set_topology():

obj = dynamics.var('NbDims', 5);    % Default: 'random' topology
obj = set_topology(obj, 'sparse');  % Now obj has 'sparse' topology

The figures below describe the topologies that class dynamics.var implements. You can click on the figures to zoom in. The numbers that appear on each edge are just illustrative values of the \\VAR coefficients
of the model, i.e. the values in matrix $B$, assuming a model of order 1 ($(p=1$).

### What now?

Now you are ready to go to Part II of this tutorial where we will generate simulated observations of a VAR model with a known topology.