Announcement

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

  • Generating Mortality Rate by Year in a Panel Data Set

    Greetings Stata Users, I trust you are all keeping well.

    Guys am working on a project in which I have a very large Panel Dataset with approximately 11 million observations and am trying to develop a panel data model for estimating the relationship between Mortality and Education and a list of other predicting variables. I want to use mortality as the outcome variable.

    And there lies my challenge, I have a few time related variables, Year (just the Year), Date of Birth (DoB), Date of Death (DoD), number of people dead (Died), Gender (Sex) and have uploaded a subset of the data here.

    All my code options have not worked and hence I have not uploaded them here.


    I need your assistance with possible strategies I can employ to generate the Mortality Rate variable per 1000 people

    Your assistance would be greatly appreciated.
    Attached Files

  • #2
    Rushambwat:
    please do not upload spreadsheets. Due to the risk of active contents nobody I know on this list will ever download them (see the FAQ about -dataex- instead). Thanks.
    See -xtpoisson-.
    Kind regards,
    Carlo
    (StataNow 18.5)

    Comment


    • #3
      Hi Carlo, my apologies I didn't know that about Excel files. I have tried to edit the post to remove the Excel file and replace with a Stata Data file which i have upload here. Please do let me know how i can remove the excel file. But i also still need help with the predicament i'm facing above .
      Attached Files

      Comment


      • #4
        Rushambwat:
        you probably need to consider survival analysis:
        Code:
        . use "C:\Users\carlo\Downloads\Subset Data Stata (2).dta" 
        
        . encode Died, g(death)
        . encode Sex, g(gender)
        
        . stset Year, failure(death==1)
        
        Survival-time data settings
        
                 Failure event: death==1
        Observed time interval: (0, Year]
             Exit on or before: failure
        
        --------------------------------------------------------------------------
              1,000  total observations
                  0  exclusions
        --------------------------------------------------------------------------
              1,000  observations remaining, representing
                998  failures in single-record/single-failure data
          1,991,883  total analysis time at risk and under observation
                                                        At risk from t =         0
                                             Earliest observed entry t =         0
                                                  Last observed exit t =     1,992
        
        . strate gender , per(1000) 
        
                Failure _d: death==1
          Analysis time _t: Year
        
        Estimated failure rates
        Number of records = 1000
        
          +-------------------------------------------------------+
          | gender     D          Y      Rate     Lower     Upper |
          |-------------------------------------------------------|
          | Female   522    1.0e+03   0.50205   0.46077   0.54701 |
          |   Male   476   952.1360   0.49993   0.45698   0.54692 |
          +-------------------------------------------------------+
           Notes: Rate = D/Y = failures/person-time (per 1000).
                  Lower and Upper are bounds of 95% confidence intervals
        
        
        
        .
        For the future, please use -daatex- to share ab excerpt of your dataset (as per FAQ). Thanks.
        Kind regards,
        Carlo
        (StataNow 18.5)

        Comment


        • #5
          Dear Carlo L, I can't thank you enough.

          This is insightful, after I saw the reply, I went and studied a number a books including Hamilton Data Analysis with Stata 12 and Handbook of Statistical Analyses with Stata/R and did quite some reading and truly, this was the solution to my predicament.

          I am implementing it and learning further


          Thank you so much.

          Comment

          Working...
          X