Hi,
I've spent 5-6 hours browsing the help files and past posts, but could not find the answer to what seems to be a very simple procedure. I used UCINet and Pajek before and want to switch to STATA working with matrices.
I have two relational variables: students and classes that they are enrolled in. I want to create a square class-by-class matrix that would show the number of students in common in each class pair. This is very similar to the classic Southern Women study, albeit with a much larger data set. The initial two-variable dataset looks like this:
class student
1 1
1 2
1 3
1 4
1 5
2 2
2 3
2 5
3 1
3 5
4 2
4 4
4 5
I want to end up with (in the above example) 4x4 class matrix (with zeros in the diagonal). I appreciate any suggestion for Stata, Mata, or nwcommands.
Cheers,
Mikhail
Related Posts with Creating a square matrix using two relational variables
z score as outcomeDear Stata users, I have two questions. Thanks in advance for your opinion. One: Is there a command…
Compare Calendar year data with Fiscal year dataHello everyone, For my thesis I gathered data from Compustat and Institutional Shareholders Service…
How to create a Financial Vulnerability Index for households using nonlinear PCA?Dear Statalist members, I am currently working with a household survey panel dataset to create a fi…
Average marginal effect (AME) vs marginal effect of the mean (MEM)?Hi all, I am trying to replicate the regression analysis shown in the attached picture. The basic s…
new to SSC vc_pack: Estimation of smooth varying coefficient modelsDear all, Thanks to Prof. Baum, a new package is available in SSC. VC_PACK is a set of commands that…
Subscribe to:
Post Comments (Atom)
0 Response to Creating a square matrix using two relational variables
Post a Comment