Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

Re: st: Adjacency matrix in Stata


From   Phil Schumm <[email protected]>
To   Statalist Statalist <[email protected]>
Subject   Re: st: Adjacency matrix in Stata
Date   Sun, 30 Mar 2014 20:11:35 -0500

On Mar 30, 2014, at 11:55 AM, jean-luc morin-chesnel <[email protected]> wrote:
> I have a panel dataset at the individual - day - product level (unbalanced) and I would like to obtain a adjacency matrix in Stata, but I do not know how to proceed.
> 
> That is, I assume that 2 individuals are connected in the network if they buy the same product the same day more than N times in my dataset (lets say N=10).
> 
> So I would like to obtain a matrix of adjacency in Stata: a MxM matrix (M in the number of investors) where the coefficient mij=1 iff investor i and investor j are connected in the network.
> 
> I do not know how to proceed because I think that I should use loops, but it seems to me that it is not very efficient to do so in Stata (the dataset is large: 100k individuals). Any suggestion is very welcomed.


Please start by telling us the problem you are trying to solve, rather than your proposed solution.  For example, it sounds like you are describing a large, sparse matrix; one way to store this is in an associative array (-help mf_asarray-).  However, without knowing more about what you are trying to do, it's difficult to offer a specific suggestion.


-- Phil


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


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index