Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

RE: st: Computation of Correlation Coefficients - COMPLEX


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   RE: st: Computation of Correlation Coefficients - COMPLEX
Date   Wed, 7 Nov 2007 17:49:04 -0000

I think you need a -reshape wide-. 

reshape wide dec, i(deid year) j(cid) 

levelsof year, local(Y) 

foreach y of local Y { 
	corr dec* if year == `y' 
}

Or, quite possibly, -pwcorr-. 



-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of John Bunge
Sent: 07 November 2007 17:36
To: [email protected]
Subject: RE: st: Computation of Correlation Coefficients - COMPLEX

Dear Nick and Bill,


thank you for your replies and your advices which I will regard in the
future.


I think I was misunderstood by Bill and want to make my problem more
explicit by stylizing the dataset I have:


. list

+-------------------------+
| cid   deid   year  dec |
|---------------------------|
| 1       1     1980  -1   |
| 1       2     1980   0   |
| 1       3     1980   1   |
| 1       4     1980   1   |
|  .       .         .        .   |  
|  .       .         .        .   |  
| 1    4000  1999  -1   |  
| 2       1     1980   0   |
| 2       2     1980  -1   |
| 2       3     1980   0   |
| 2       4     1980   1   |
|  .       .         .        .   |  
|  .       .         .        .   |  
| 2    4000  1999  -1   |  
|  .       .         .        .   |  
|  .       .         .        .   |  
|200    1     1980  -1   |
|200    2     1980   0   |
|200    3     1980   0   |
|200    4     1980  -1   |
|  .       .         .        .   |  
|  .       .         .        .   |  
|200  4000  1999  1   |  
+-------------------------+

with cid - number of country (1-200), deid - number of decision
(1-4000), 
and dec - decision (1 for 'yes', 0 for 'abstain' and -1 for 'no').


(i do not know if this table will be displayed the way I see it here in
my e-mail programme,
i only can hope that is going to be shown accurately)



The correlation coefficients (cc's) for the decisions I want to compute
are:

between country 1 and 2, between country 1 and 3, ..., between country 1
and 200,...
between country 199 and 200, respectively. The total number of cc's 
will be (200*199)/2 = 19,900.

Now note that I need these coefficients for every single year, not over
all decisions 
during the whole time period 1980 - 1999. So in the end, I will have the
coefficients
for the country-pair 1-2 (and for all other country pairs, too) for
1980, for 1981, ..., 
and for 1999. That is, in the end I will have 19,900*20 = 398,000
coefficients.



Any helpful suggestions are highly appreciated.



Sorry for having set up the problem in a precipitate manner.

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index