Statalist


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

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


From   "Christian Winzer" <christian.winzer@gmx.de>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: AW: correlation between time-series of panel data
Date   Wed, 23 Sep 2009 10:57:13 +0100

That was quick - thank you very much!


Judge Business School
University of Cambridge
Trumpington Street
Cambridge CB2 1AG, UK

m: +44 7503 714974
f: +44 1223 339701
e: cw420@cam.ac.uk
w: www.eprg.group.cam.ac.uk

> -----Original Message-----
> From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-
> statalist@hsphsun2.harvard.edu] On Behalf Of Martin Weiss
> Sent: 23 September 2009 10:26
> To: statalist@hsphsun2.harvard.edu
> Subject: st: AW: correlation between time-series of panel data
> 
> 
> <>
> 
> 
> 
> *************
> 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/


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