Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • creation of monthly observation from yearly observation in stata

    Dear Statalists,

    I wish to expand an event history longitudinal data to accommodate months. The data is already in years of event occurrence for each identity. It runs for a few years (1980-1992) and has been collected in waves 1-12. I could easily change the waves to years of occurrence but i desire to expand it and specify it as monthly survival data. I would then tie the event occurrence to random months within the year of occurrence or say the nth month of the year. Basically, it might turn out to look like a continuous flow of event occurrence instead of having a discrete event time in just years of occurrence.

    I have used the following code:

    bysort pid wave: gen month = dofm(wave)
    format month %tm
    stset month, id(pid) failure(FTowner)
    stsplit, at(failure)


    I am sure i have not done enough to carry out the intended task. Please help!

  • #2
    So, there are several things wrong here.

    1. dofm() takes a monthly date and returns a daily date equal to the first date of the month. That's the reverse of what you say you want. You have daily dates and want to create monthly dates. The function for that is mofd().

    2. If you replace dofm() with mofd(), you will be setting the date to be the first day of the month that is recorded in the wave variable. It's unclear to me what the wave variable records anyway. On the one hand you seem to imply it just gives the year: 1980-1992). But if that's what it actually says, then you don't actually have a date variable there and mofd() will give you garbage. In order for mofd() to produce a coherent result you would have to first convert wave to a date variable. So one might do something like -gen wave2 = mdy(1, 1, wave), to set wave2 equal to January 1 of the wave year.

    3. Regardless of how you proceed above, your month variable is going to reflect the month specified in the variable wave, or in whatever you do to transform wave before feeding it into mofd().

    4. I don't understand the rationale for the entire undertaking. You have perfectly good data and you are proposing to add noise or bias to it. For what end? At the end of the day, you have only annual information, and nothing you do, other than going back and collecting more granular data, will give you the precision of monthly data.

    Comment


    • #3
      Thanks for the reply Clyde. I find your reply helpful and have equally learned from it.

      Like you said:

      "I don't understand the rationale for the entire undertaking. You have perfectly good data and you are proposing to add noise or bias to it. For what end? At the end of the day, you have only annual information, and nothing you do, other than going back and collecting more granular data, will give you the precision of monthly data"

      I was trying to modify my dataset by expanding it further into months of event (which in this case does not exist originally). I supposed an expanded dataset gives better estimation in complex analyses in Cox regression. However, I can see that converting the years into mdy cannot be done beyond generally affixing the dates to a specific day/month of the year of occurrence, and thus remains. So I think the expansion I was trying to do does not make the data any better except I have the actual monthly collection.

      Thank you,
      Dammy

      Comment

      Working...
      X