To expand on Austin's advice, there are then lots of ways of defining
correlation, ranging from collapsing each panel to a single data point
to something more elaborate.
Loss of independence may not be crucial unless you really want P-values
or confidence intervals (and in either case you need to worry about
distributions too). By Cauchy-Schwarz correlations are bounded by [-1,1]
regardless of generating process. The bigger issue is disentangling
within-panel and between-panel variation, which implies that you need an
appropriate model.
In short, I think you need to signal more of what you want to get better
advice.
Nick
[email protected]
Ricardo Ovaldia replied to Austin Nichols:
>Sure:
>corr y x
The problem is that I have non-independent observations. Longitudinal
(panel) data. Multiple measurements per patient over time. Pearson's
correlation assumes independence, therefore -corr- is not appropiate.
Ricardo Ovaldia<[email protected]> :
Sure:
corr y x
but I guess you have something else in mind--perhaps you could
clarify. Maybe you want to allow mean and SD to change over time, and
standardize by time e.g.
webuse psidextract, clear
corr lwage ed
ren lwage y
ren ed x
egen my=mean(y), by(t)
egen sy=sd(y), by(t)
egen mx=mean(x), by(t)
egen sx=sd(x), by(t)
g zy=(y-my)/sy
g zx=(x-mx)/sx
reg zy zx, nocons
corr zy zx
On Mon, Jul 20, 2009 at 9:51 AM, Ricardo Ovaldia<[email protected]>
wrote:
> Is there a way to estimate a correlation coefficient of two continuous
measurements each collected over time on a sample of patients? Not sure
if I can do this with -xtreg- for example.
*
* 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/