Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: Efficient way to create adjacency matrix in Mata


From   Benjamin Allaire <btallaire@hotmail.com>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: Efficient way to create adjacency matrix in Mata
Date   Wed, 29 Jun 2011 16:01:41 -0400

Listers -

Question: what is the most efficient way to create an adjacency matrix in mata, 
given a unique identifier ("id") and a club id ("club_id") for folks in the same club.

So the data looks like this:

id    club_id
1       1
2       1
3       2
4       2
5       2

Is there a clever way to do it without looping over the people? 

Any help would be most appreciated,

Thanks,
Ben

 		 	   		  
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index