DYNAMICLINEAR Procedure

Multiple Representations of the Adjacency Matrix

For the adjacency matrix bold upper Gamma, the matrix entries bold upper Gamma left parenthesis bold i comma bold j right parenthesis indicate whether variable j belongs to the parental set of variable i. These entries must be binary (0 or 1), and all diagonal elements must be set to zero; that is, bold upper Gamma left parenthesis bold i comma bold j right parenthesis takes the value of 0 or 1, and for all i, bold upper Gamma left parenthesis bold i comma bold i right parenthesis equals 0. Here, i and j range from 1 to n, where n is the total number of variables in the data set. The adjacency matrix is not required to be symmetric, implying that bold upper Gamma left parenthesis bold i comma bold j right parenthesis does not necessarily equal bold upper Gamma left parenthesis bold j comma bold i right parenthesis.

The bold upper Gamma matrix might be formatted in one of two ways:

  • A single or multiple full adjacency matrices can be provided. For a single matrix, the data table should include all variables in the MODEL statement along with an additional variable VarID, which indexes the variables according to their order in the statement. When multiple matrices are present, the data table must also include the variable RowID for the purpose of ordering. If there are n matrices in the data table and m observations for which m > n, then each of the first n minus 1 matrices correlates with the n minus 1 observations, and the last matrix applies to the subsequent m minus n plus 1 observations. Note: For different adjacency matrices that correspond to distinct time points, it is imperative to maintain a consistent number of candidates within each variable’s parental set across all time points. For example, if the variable y1 has two candidates in its parental set at the initial time point, it must retain a parental set of two throughout all subsequent time points. This consistency must be followed for all variables.

  • A compact form of the adjacency matrix is also available for use when suitable. In this approach, the data table that you specify in the INADJACENCY= option in the PARENTALSET statement should have as many observations as there are nonzero entries in the adjacency matrix. This data table has precisely two columns, which record the row and column indices of the nonzero elements. You can find an example of the compact form input in the section Simultaneous Graphical Dynamic Linear Models.

Compact Representation of the Adjacency Matrix

PROC DYNAMICLINEAR facilitates a more streamlined input process by allowing a compact representation of bold upper Gamma. To use this compact form, specify a data table that contains just two variables via the INADJACENCY= option. In this efficient format, the number of rows in the data table, each of which corresponds to an observation, should match the total count of nonzero elements in bold upper Gamma.

When you use this compact representation, the data table must include these two columns:

  • ParentID: Identifies the variable that is considered the "parent" in the relationship.

  • ChildID: Denotes variables that are "children," meaning that they are part of the parent variable’s parental set.

The values in ParentID and ChildID are not arbitrary but should directly correspond to the order of variables as they are listed in the MODEL statement.

As an illustration, consider a compact representation for an adjacency matrix bold upper Gamma 1,

bold upper Gamma 1 equals Start 4 By 4 Matrix 1st Row 1st Column 0 2nd Column 1 3rd Column 0 4th Column 1 2nd Row 1st Column 1 2nd Column 0 3rd Column 0 4th Column 0 3rd Row 1st Column 0 2nd Column 0 3rd Column 0 4th Column 1 4th Row 1st Column 1 2nd Column 0 3rd Column 1 4th Column 0 EndMatrix

Here is the code for how such a table would be structured:

   data Gamma_1;
      input ParentID ChildID;
   datalines;
   1 2
   1 4
   2 1
   3 4
   4 1
   4 3
   ;

In instances where a variable’s parental set is empty, meaning that it has no members, two methods are available to denote this in the compact form of an adjacency matrix. For illustration, consider that the parental sets for the second and third variables (ParentID = 2 and ParentID = 3, respectively) are empty. You can take the following approaches:

  1. Assign ChildID = 0 to the variable that has an empty parental set, which in this example would apply to ParentID = 2.

  2. Omit the entire row that corresponds to the variable that has the empty set, as would be the case for ParentID = 3.

A compact code representation of the adjacency matrix bold upper Gamma 2,

bold upper Gamma 2 equals Start 4 By 4 Matrix 1st Row 1st Column 0 2nd Column 1 3rd Column 0 4th Column 1 2nd Row 1st Column 0 2nd Column 0 3rd Column 0 4th Column 0 3rd Row 1st Column 0 2nd Column 0 3rd Column 0 4th Column 0 4th Row 1st Column 1 2nd Column 0 3rd Column 1 4th Column 0 EndMatrix

is as follows:

   data Gamma_2;
      input ParentID ChildID;
   datalines;
   1 2
   1 4
   2 0
   4 1
   4 3
   ;

Full Representation of the Adjacency Matrix

The following code is an example of a full adjacency matrix. In this matrix, the presence of a 1 indicates that the column variable is in the parental set of the row variable. For example, the variables y2 and y3 are in the parental set of the variable y1, the variables y3 and y4 are in the parental set of the variable y2, and the pattern continues accordingly.

data mylib.adjacency;
   input VarID y1 y2 y3 y4 y5;
datalines;
1   0  1  1  0  0
2   0  0  1  1  0
3   0  1  0  1  0
4   0  1  1  0  0
5   0  0  1  1  0
;

In scenarios where multiple adjacency matrices are required—such as for two distinct adjacency matrices—you can code the specification as follows:

data mylib.multi_adjacency;
   input VarID y1 y2 y3 y4 y5 RowID;
datalines;
1   0  1  1  0  0  1
2   0  0  1  1  0  2
3   0  1  0  1  0  3
4   0  1  1  0  0  4
5   0  0  1  1  0  5
1   0  1  0  1  0  6
2   0  0  1  0  1  7
3   1  0  0  1  0  8
4   1  0  1  0  0  9
5   0  1  1  1  0  10
;
Last updated: July 09, 2026