Dear All,
I previously posted on the General forum (http://www.statalist.org/forums/foru...-two-variables). But this question is more appropriate for mata or other matrix related forum. Taking the advice from a regular stata forum user, I hope to clarify my problem and get help from you all. Thanks very much !
I have a stata dataset with over 70,000 observations, below is a pretend data :
Industry_row Industry_column xvar
11A0 1121 2
11A0 11A0 1
11A0 3122 4
11B0 1129 2
11B0 2111 3
Industry_row is the input industry, and industry column is the output industry. My real data has 450 unique Industry_row and 473 unique Industry column.
Task 1: develop a matrix that has rows from input industry and columns from output industry and the elements of the matrix contain xvar value. If the row and column pair has no xvar value, so the expected output in matrix form:
My research question is to compute the eigenvalue and construct the eigenvector using the adjacency matrix above. My matrix needs to be square and symmetric. Therefore,
Task 2 is to expand the matrix , I thought of using all combinations of input and output industries, that is the matrix will be 6*6 dimensions with (11A0, 11B0, 1121, 3122, 1129, 2111) as rows and columns. the xvars will be zeros for the row and column pairs that were not in the dataset.
Task 3: I will compute eigenvector centrality measure (a network measure), this can only be applied to symmetric adjacency matrices. Therefore, I need to make the matrix from step 2 symmetric . Following the literature, I plan to take the maximum value of the upper and lower triangles
the resulting matrix should look like
basically, if the original data has 11A0 1121 with xvar =2, we will assign 1121 11A0 pair's xvar a value of 2 (replace 0).
I got help from Nick, Roberto and a few others sample programs to do task 1 and 2 from my previous posting (http://www.statalist.org/forums/foru...-two-variables). Based on their suggestion, I post it to this new forum related to matrix.
If you could help with task 3, to make it symmetrical, and task 4, compute eigenvalue and develop eigenvector for this matrix, that will be greatly appreciated.
Best,
Rochelle
I previously posted on the General forum (http://www.statalist.org/forums/foru...-two-variables). But this question is more appropriate for mata or other matrix related forum. Taking the advice from a regular stata forum user, I hope to clarify my problem and get help from you all. Thanks very much !
I have a stata dataset with over 70,000 observations, below is a pretend data :
Industry_row Industry_column xvar
11A0 1121 2
11A0 11A0 1
11A0 3122 4
11B0 1129 2
11B0 2111 3
Industry_row is the input industry, and industry column is the output industry. My real data has 450 unique Industry_row and 473 unique Industry column.
Task 1: develop a matrix that has rows from input industry and columns from output industry and the elements of the matrix contain xvar value. If the row and column pair has no xvar value, so the expected output in matrix form:
1121 | 11A0 | 3122 | 1129 | 2111 | |
11A0 | 2 | 1 | 4 | ||
11B0 | 2 | 3 |
Task 2 is to expand the matrix , I thought of using all combinations of input and output industries, that is the matrix will be 6*6 dimensions with (11A0, 11B0, 1121, 3122, 1129, 2111) as rows and columns. the xvars will be zeros for the row and column pairs that were not in the dataset.
Task 3: I will compute eigenvector centrality measure (a network measure), this can only be applied to symmetric adjacency matrices. Therefore, I need to make the matrix from step 2 symmetric . Following the literature, I plan to take the maximum value of the upper and lower triangles
the resulting matrix should look like
11A0 | 11B0 | 1121 | 3122 | 1129 | 2111 | |
11A0 | 1 | 0 | 2 | 4 | 0 | 0 |
11B0 | 0 | 0 | 0 | 0 | 2 | 3 |
1121 | 2 | 0 | 0 | 0 | 0 | 0 |
3122 | 4 | 0 | 0 | 0 | 0 | 0 |
1129 | 0 | 2 | 0 | 0 | 0 | 0 |
2111 | 0 | 3 | 0 | 0 | 0 | 0 |
I got help from Nick, Roberto and a few others sample programs to do task 1 and 2 from my previous posting (http://www.statalist.org/forums/foru...-two-variables). Based on their suggestion, I post it to this new forum related to matrix.
If you could help with task 3, to make it symmetrical, and task 4, compute eigenvalue and develop eigenvector for this matrix, that will be greatly appreciated.
Best,
Rochelle
Comment