Statalist


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

st: AW: correlation between time-series of panel data


From   "Martin Weiss" <martin.weiss1@gmx.de>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: AW: correlation between time-series of panel data
Date   Wed, 23 Sep 2009 11:26:14 +0200

<> 



*************
clear*


inp str1 Category	timestep 	value
A		1		5	
A		2		6
A		3		7
B		1		8	
B		2		8	
B		3		10
end

compress

reshape wide value, i(timestep) j(Category) string
list, noobs  
*************



HTH
Martin

-----Ursprüngliche Nachricht-----
Von: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] Im Auftrag von Christian
Winzer
Gesendet: Mittwoch, 23. September 2009 11:21
An: statalist@hsphsun2.harvard.edu
Betreff: st: correlation between time-series of panel data

Hello,
I have spent the past day searching (the archive, faqs, the web) but haven't
found a way to calculate the correlation coefficients between time-series
belonging to different categories in a panel data set.

The data has the format:

Category 	timestep 	value
A		1		5	
A		2		6
A		3		7
B		1		8	
B		2		8	
B		3		10


In this example I would thus calculate the correlation between the
timeseries of 'value' for category A and category B.
So one option would be to change the data format to the following: 

timestep 	valueA	valueB
1		5		8
2		6		8
3		7		10

Then the standard correlate valueA valueB works. 
Unfortunately I don't know how to do that transformation. 

I have thus tried the following direct solutions, but without success:
1) correlate value, by(category) -> 'option by() not allowed'
2) by category: correlate value -> only produces correlation of 'value'
within each category (=1), instead of across categories A and B
3) statsby, by(category): -> 'no; data in memory would be lost'

Thank you very much for your help,

Christian

*
*   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/


*
*   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   |   What's new   |   Site index