Prepare covariates and optional response in adjacency matrix form. If undirected, the values are drawn from the lower triangle of the adjacency matrices.
inputs_lmnet(Xlist, Y =NULL, directed =TRUE, add_intercept =TRUE, time_intercept =FALSE)
Arguments
Xlist: List of n×n×tmax matrices, possibly containing response matrix labeled `Y'. Diagonals (self-loops) are ignored.
Y: Optional n×n×tmax response matrix. NAs in this matrix will be automatically removed. Diagonals (self-loops) are ignored.
directed: Optional logical indicator of whether input data is for a directed network, default is TRUE. Undirected data format is lower triangle of adjacencey matrix.
add_intercept: Optional logical indicator of whether intercept should be added to X, default is TRUE.
time_intercept: Optional logical indicator of whether separate intercept should be added to X for each observation of the relational matrix, default is FALSE.
Returns
A list of: - Y: Vector of responses (column-wise vectorization order) of appropriate length.
X: Matrix of covariates (column-wise vectorization order) of appropriate size.
nodes: 2-column matrix (or 3-column for repeated observations) indicating directed relation pairs to which each entry in Y and each row in X corresponds.
Details
This function takes a list of network covariates (in adjacency matrix form) and prepares them for the regression code lmnet. Accomodates 3-dimensional relational arrays with tmax repeated observations of the network (over time or context). Typical network data with a single observation may be input as matrices, i.e. tmax = 1.