Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: strange results with corr


From   Richard Williams <Richard.A.Williams.5@nd.edu>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: strange results with corr
Date   Thu, 17 Feb 2005 10:56:34 -0500

At 09:44 AM 2/17/2005 -0600, Kenley Barrett wrote:
I am getting strange results when I run the "corr" command on my
variables. From my understanding, "corr" gives the correlation
coefficient, so if a value of 1 for Dummy Variable A guarantees a
value of 0 for Dummy Variable B, then corr should give a result of -1.
But instead I am getting values between 0 and -1. A sample of two
variables shown below:

. count if wifelit == 1 & wifeprim == 1
    0

. count if wifelit == 0 & wifeprim == 1
 2458

. corr wifelit wifeprim
(obs=14316)

             |  wifelit wifeprim
-------------+------------------
     wifelit |   1.0000
    wifeprim |  -0.1062   1.0000
I'm not sure how your count statements show that you should have perfect negative correlation - in particular, it won't be perfect if wifeprim = 0 and wifelit ever equals anything other than 1. Why don't you do a crosstab of the 2 variables, e.g. -tab wifelit wifeprim- .

*
* 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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index