Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | Nick Cox <njcoxstata@gmail.com> |
To | "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu> |
Subject | Re: st: Longitudinal analysis - help! |
Date | Wed, 13 Nov 2013 18:14:30 +0000 |
This to me is a very interesting area, indeed a long-standing, although slow-moving, personal preoccupation. The background here of why you have irregular measurements and particularly why you sometimes, but not always, have simultaneous measurements for X and Y, might be relevant for what kind of analysis makes sense. Your data could be reorganised to allow various -xt- commands, but it's hard to see that you can use times when only one variable is measured. There is literature on time series analysis for irregularly spaced data. The Wikipedia article http://en.wikipedia.org/wiki/Unevenly_spaced_time_series is short, but in my view spot on. For some related discussion see http://www.stata.com/statalist/archive/2013-02/msg00484.html http://www.stata.com/statalist/archive/2013-02/msg00487.html There are several routines for interpolation in Stata, including -ipolate-, -cipolate- (SSC), -csipolate- (SSC), -pchipolate- (SSC) and -nnipolate- (SSC). For reasons I do not fully understand there is massively more interest in imputation for time series data (which is always complicated, and almost always difficult to defend, because most missingness is strongly non-random) than in interpolation (which is always simple, and almost always difficult to defend, for different reasons). Nick njcoxstata@gmail.com On 13 November 2013 17:00, K Jensen <k.x.jensen@gmail.com> wrote: > I have two time series, of values recorded at irregular intervals. I > would like to see if one variable (X) predicts the other (Y), > particularly whether high exposure to X increases the value of Y (the > effect would be some months afterwards, but the interval over which a > high has an effect is not known precisely and is likely to differ from > person to person). X is measured more often than Y. > > Both X and Y vary from observation to observation, with some subjects > having repeated "highs" of X, some dipping out of high and low in > complex ways. > > From what I know of time series analysis, this assumes that you have > observations at regular intervals, such as yearly or monthly, whereas > mine are irregularly spaced. > > I am familiar with time varying covariates in Cox proportional > hazards, but not other models. > > I also have some non-time varying covariates that I would like to take > into account. > > Can anybody recommend a command in Stata to analyse this dataset? > > Thankyou > > Karin > > P.S. - The dataset is very simple and basically looks like this: > > id type value date > 1 X 11.1 15/09/2010 > 1 Y 113.1 18/03/2011 > 1 X 15 06/07/2011 > 1 X 11.7 21/10/2011 > 1 Y 124.5 21/10/2011 > 1 X 14.4 27/01/2012 > 1 X 12.9 04/05/2012 > 1 Y 132.3 04/05/2012 > 1 Y 116.9 07/09/2012 > 1 X 14.7 07/09/2012 > 1 Y 127.7 13/12/2012 > 1 X 13.2 13/12/2012 > 2 X 11.1 18/02/2011 > 2 X 14.1 26/05/2011 > 2 X 14.7 21/10/2011 > 2 X 16.2 19/12/2011 > 2 X 14.1 15/06/2012 > 2 Y 119.9 03/10/2012 > 2 X 13.8 03/10/2012 > 2 Y 120.7 22/10/2012 > 2 X 9.9 22/10/2012 > 3 X 17.1 08/05/2003 > 3 X 12 20/08/2003 > 3 X 15.6 09/12/2003 > 3 X 14.7 20/05/2004 > 3 X 13.2 28/09/2004 > 3 X 12.6 16/03/2005 > 3 X 11.4 19/10/2005 > 4 Y 110 26/11/2008 > 4 X 15.6 26/11/2008 > 4 X 15.9 04/06/2009 > 4 Y 110.8 04/06/2009 > 4 X 16.5 27/08/2009 > 4 Y 100.8 27/08/2009 > 4 Y 110.6 24/11/2009 > 4 X 14.7 24/11/2009 > 4 Y 100.3 25/02/2010 > 4 X 18.3 25/02/2010 > 4 X 22.2 01/07/2010 > 4 Y 120.1 01/07/2010 > 4 X 18 13/10/2010 > 4 Y 130.6 13/10/2010 > 4 Y 120.6 18/01/2011 > 4 X 20.4 18/01/2011 > 4 X 11.7 05/05/2011 > 4 Y 110.5 05/05/2011 > 4 Y 110.6 20/09/2011 > 4 X 16.5 03/11/2011 > 4 Y 120.8 03/11/2011 > 4 Y 120.7 08/05/2012 > 4 X 19.5 08/05/2012 > 4 X 17.7 26/07/2012 > 4 Y 110.6 25/01/2013 > 4 X 15 25/01/2013 > * > * 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/