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

RE: st: correlation for longitudinal data

 From "Nick Cox" To Subject RE: st: correlation for longitudinal data Date Tue, 21 Jul 2009 14:56:30 +0100

```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
n.j.cox@durham.ac.uk

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<ovaldia@yahoo.com> :
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<ovaldia@yahoo.com>
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/
```

 © Copyright 1996–2015 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index