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

Re: st: correlation panel data


From   Chris Rohlfs <car@uchicago.edu>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: correlation panel data
Date   Thu, 27 Mar 2003 14:56:37 -0600 (CST)

thomas,

i would try just running pairwise regressions betweenyour different
regressors using xtreg, xtgee, or areg.  to get the correlation between x
& y this approach, do the following.

	regress y on x.  let's call the coefficient _b[x]
	regress x on y.  let's call that coefficient _b[y]

	now the correlation between x & y is equal to (_b[x]*_b[y])^0.5

now, let's say "id" is the panel id variable & that there are random
effects by id.  in stata code, we'd do:

	xtreg y x, re i(id)
* here we're saving the coefficient in a local macro called `bx'
	local bx = _b[x]

	xtreg x y, re
	local by = _b[y]

* here we're making a new macro equal to the correlation
	local r = (`bx'*`by')^0.5
* here we ask stata to show us the value for our new correlation.
	macro list _r

On Thu, 27 Mar 2003, Tomas Zamora wrote:

> Hi all!
> 
> I'm a very new user of Stata and it's wonderful! I'm working with panel data and I'm also new in that. I would like to know how to check for multicollinearity among variables.
> 
> I know the corr comand, but this is not for panel data (unless you work in wide format, but in that case I'm not sure if the results are very good). Then I can use xtcorr, but this should be used after xtgee and I think that the spirit then is to check correlations among residuals, not correlations among variables.
> 
> Can someone help me and give me a hint on how to check correlations among variables before start working?
> 
> Thanks for your help!
> Sincerely,
> Tomas
> 
> 
> _________________________________________________________
> http://www.latinmail.com.  Gratuito, latino y en espaņol.
> 
> 
> *
> *   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/
> 



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