I recently came across a large data set that contains the so-called Flow of Funds between economic agents. The Flow of Funds gives, for each economic agent (households, non-financial corporation, central bank) to whom it is indebted to and, consequently, it also gives the financial claims of one agent onto others.
The data are presented in different "layers" such that there are different levels of aggregation in the data. For instance, the total economy (level 1) is divided into financial corporations non-financial corporations and households (level 2). Financial corporations is then divided into Central Bank and Banks (level 3). Another level 1 data is the Rest of the World.
You can see that for instance, Banks have claims on domestic Households, and on the Rest of the World, but that domestic Households have claims on the rest of the world.
All this information is in the form of a big matrix where the contents is the net claims of each economic agent onto the other. In my example, that would be a 7x7 matrix with some zero entries. The first row is Total Economy (code 1), the second row is Financial corporations (code 1.1), the third is Central Bank (1.1.1), the fourth is Banks (1.1.2), the fifth is Non-financial corporations (1.2), the sixth is Households (1.3) and the last is the Rest of the World (code 2.) The same principle applies for the columns.
It is clear that row 1 is the sum of rows 2, 5 and 6. It is also clear that row 2 is the sum of rows 3 and 4. In that, I know that the matrix is not full-rank.
Now, my question: How can I, using linear algebra, identify which row is a linear combination of others, conditioning on the level that I am interested in such that I do not want that row 1 is the sum of rows 3, 4, 5, 6 but the sum of rows 2, 5 and 6?
My idea would be to first calculate the rank of the matrix. If the matrix is full-rank, then there is no accounting identities. If the matrix is of rank $k<n$, then there are $(n-k)$ accounting identities. Yet, I do not know which.
Your rank idea is correct.
Now suppose rank is $<n$. To see whether row $1$ is a linear combination of rows $2, 5, 6$, simply put row $1$ at the bottom, rows $2, 5, 6$ on top of it, and do Gaussian elimination. If the last row can be reduced to $0$, then it is a linear combination of the top three rows.