Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: R: creating differences when time periods are misssing


From   "Carlo Lazzaro" <carlo.lazzaro@tin.it>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: R: creating differences when time periods are misssing
Date   Thu, 1 Nov 2007 11:11:59 +0100

Dear Scott,

there possibly another problem arising from your post, that is the reason
why these data are missing. Are they missing completely at random (MCAR), at
random (MRA)or otherwise their missing depends upon the unobserved answers
(not missing at random (NMAR)?

Should your missing be MCAR or MRA type, I suppose you can take a look at an
article I am going to send you off the list.

Sorry I cannot be more helpful as Stata codes are concerned.

Kind Regards,

Carlo

-----Messaggio originale-----
Da: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] Per conto di Scott Cunningham
Inviato: mercoledý 31 ottobre 2007 19.34
A: statalist@hsphsun2.harvard.edu
Oggetto: st: creating differences when time periods are misssing

My data is a longitudinal dataset of individuals who were interviewed
from 1997 to 2004.  I have data on individual ages (measured as months
from birth month).  Because this interview did not always,
consistently, ask individuals exactly 12 months after the last
interview, I have been trying to control for differences in time since
the last interview by differencing their ages as so:

. gen dt=d.amo

where "amo" is "age in months."  I notice that this works so long as I
have values of amo in both the current and previous year.  But there
are some people who disappear from the survey only to return a year
later.  They look like this:

        +----------------------------------+
        |  id   rp   age   amo   dt   year |
        |----------------------------------|
   56. |  27    0    15   189   12   1997 |
   57. |  27    .     .     .    .   1998 |
   58. |  27    4    18   226    .   1999 |
   59. |  27    3    19   237   11   2000 |
   60. |  27    8    20   247   10   2001 |
   61. |  27    6    21   259   12   2002 |
   62. |  27    4    22   273   14   2003 |
       |----------------------------------|
   63. |  27    1    23   283   10   2004 |

The relevant variables are:  id (indiciating this is the same person),
amo (age in months on day of interview), dt (time since last
interview), and year.  Ignore the "rp" variable, but note that this
variable measures something which depends on "dt" since it is a
measure of something done since the date of the last interview.

So, the problem is "dt" is missing twice.  Once when all values are
missing because the person was not interviewed.  A second time when he
comes back in.  Ideally, I would like to know how to create
differenced values for dt equal to (226-189), since the respondent is
226 months old on the day of the interview and was 189 the last time
interviewed.  What's the most efficient code to do this?
*
*   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