NetInd_mat_Kmax6: An example of a network ID matrix

Description Usage Details Examples


This matrix demonstrates an internal data structure of how tmlenet stores the input network. The network in this matrix is derived from the column "Net_str" of the dataset df_netKmax6. Both, this matrix and the vector of strings in column "Net_str", represent the same network and both can be used for specifying the input network to tmlenet function. The network matrix may be specified by using the argument NETIDmat of the tmlenet function. Inputing the network via this type of a matrix may lead to significant reduction in total run time, since any network specified as a vector of strings, such as in column "Net_str", will be first converted to this type of matrix representation.




See below and Example 3 in tmlenet help file for examples constructing this matrix from the initial network input in column "Net_str" of df_netKmax6.

This matrix consists of 1000 rows and 6 columns. Each row i encodes a vector of network IDs of observation i in df_netKmax6, i.e., NetInd_mat_Kmax6[,i] contains a vector of observation row numbers in df_netKmax6 that are presumed "connected to" (or "friends of") observation i. Each observation can have at most 6 friends and if an observation i has fewer than 6 friends the remainder row of NetInd_mat_Kmax6[,i] is filled with NAs.


Net_str <- df_netKmax6[, "Net_str"]
IDs_str <- df_netKmax6[, "IDs"]
net_ind_obj <- simcausal::NetIndClass$new(nobs = nrow(df_netKmax6), Kmax = ncol(df_netKmax6))
net_ind_obj$makeNetInd.fromIDs(Net_str = Net_str, IDs_str = IDs_str, sep = ' ')
NetInd_mat <- net_ind_obj$NetInd

tmlenet documentation built on May 29, 2017, 2:22 p.m.