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: Panel data correlation


From   "Cohen, Elan" <cohened@upmc.edu>
To   "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu>
Subject   RE: st: Panel data correlation
Date   Tue, 1 Apr 2014 18:02:58 +0000

This is my guess.  Anderson would like to look at the correlation across years, but -correlate- isn't structured to handle data in long format.  Hence, we need to -reshape wide-.

reshape wide CA PFI, i(country) j(years)
corr CA*
corr PFI*

The above code has not been tested.  Hope this helps.

- Elan


-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Nick Cox
Sent: Tuesday, April 01, 2014 13:50
To: statalist@hsphsun2.harvard.edu
Subject: Re: st: Panel data correlation

Sorry, but I can't add to my previous answer as I don't think you are
posing a precise question.

What's different may be what makes sense to your project, but pooling
countries and years just mixes different kinds of variation and would
produce something difficult to interpret. The point is usually made in
broader discussions of cross-sectional and panel analyses.
Nick
njcoxstata@gmail.com


On 1 April 2014 18:43, Anderson Macedo de Jesus <andemacj@me.com> wrote:
> Nick,
> I have two variables and I need to check the correlation between them in a panel data, but I have a panel data for 135 countries described as follows:
>
> countries                       years           CA              PFI
> Brazil                  1990            12              20
> Brazil                  1995            10              5
> Brazil                  2000            40              1
> Brazil                  2005            4               40
> Brazil                  2010            20              30
> Netherlands             1990            100             30
> ...
>
> I have been dealing with these data for a while and I could notice that it is a bit different to deal with panel data. So, I would like to know whether or not I can use the simple -correlate- command or there is something different. Thats my question. I don't want to make a big mistake
> Thanks
> Anderson
>
>
> On Apr 1, 2014, at 7:31 PM, Nick Cox <njcoxstata@gmail.com> wrote:
>
>> The Pearson correlation between two variables can be calculated with
>> -correlate-. You could restrict that to different years or even
>> different countries, although I wouldn't pay anything for correlations
>> based on 5 values. So, what's the precise question?
>>
>> Nick
>> njcoxstata@gmail.com
>>
>>
>> On 1 April 2014 18:25, Anderson Macedo de Jesus <andemacj@me.com> wrote:
>>
>>> I need to check the correlation btw two variables in a panel data in a long format (135 countries with 5 different years for each variable). How can I do that?
>>> As I could realize it is not possible to run the pearson correlation, right? So, I could I do that?
>> *
>> *   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/

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


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