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
jean-luc morin-chesnel <[email protected]>
To
[email protected]
Subject
Re: st: Adjacency matrix in Stata
Date
Mon, 31 Mar 2014 11:09:11 +0200
Thank you Phil for your answer!
Brendan's suggestion is what I was looking for actually.
Best,
Hedi
On 31 March 2014 03:11, Phil Schumm <[email protected]> wrote:
> 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/
*
* 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/