DYNAMICLINEAR Procedure
Multiple Representations of the Adjacency Matrix
For the adjacency matrix , the matrix entries
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,
takes the value of 0 or 1, and for all i,
. 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
does not necessarily equal
.
The 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 variableRowIDfor the purpose of ordering. If there are n matrices in the data table and m observations for which m > n, then each of the firstmatrices correlates with the
observations, and the last matrix applies to the subsequent
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
y1has 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 . 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
.
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 ,
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:
Assign
ChildID= 0 to the variable that has an empty parental set, which in this example would apply toParentID= 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 ,
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
;