Announcement

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

  • How can I compare two trends?

    Hello,

    I am working on a national dataset with about 100 variables. I would like to compare the trends in the number of hospitalizations of disease 1 (dx1) with disease 2 (dx2). I would like to see if for example dx1 is growing faster than dx2 over the years. Previously I have used nptrend command to see the direction of each trend individually, but I have never compared two trends together.

    I would appreciate any advice and help regarding how to proceed and the best methodology to use. Thank you so much!


    Below is the sample data created with dataex:

    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input float(year dx1 dx2)
    2000 411406 1.22e+08
    2001 445924 1.25e+08
    2002 462794 1.29e+08
    2003 479691 1.29e+08
    2004 504995 1.39e+08
    2005 516516 1.34e+08
    2006 527392 1.35e+08
    2007 537801 1.38e+08
    end

  • #2
    A line graph is a basic way to compare two trends. For example:

    Code:
    . gen lndx1 = ln(dx1)
    . gen lndx2 = ln(dx2)
    . twoway line lndx1 lndx2 year

    Comment


    • #3
      Originally posted by Anders Alexandersson View Post
      A line graph is a basic way to compare two trends. For example:

      Code:
      . gen lndx1 = ln(dx1)
      . gen lndx2 = ln(dx2)
      . twoway line lndx1 lndx2 year

      Thank you for your reply, Anders. What if I want to get a statistical comparison instead of just eyeballing and interpreting the line graph?

      Comment


      • #4
        A graph is a statistical comparison, and a very good one.

        I suspect you want a test. This will require a model. So your next step is to decide what model you want. This is a substantive decision, so that decision can only be made by you. We can help you with how to implement such decisions, but only you can make substantive decisions for your analysis.
        ---------------------------------
        Maarten L. Buis
        University of Konstanz
        Department of history and sociology
        box 40
        78457 Konstanz
        Germany
        http://www.maartenbuis.nl
        ---------------------------------

        Comment


        • #5
          Originally posted by Maarten Buis View Post
          A graph is a statistical comparison, and a very good one.

          I suspect you want a test. This will require a model. So your next step is to decide what model you want. This is a substantive decision, so that decision can only be made by you. We can help you with how to implement such decisions, but only you can make substantive decisions for your analysis.

          Sure, I agree. So let's say I want to test whether slope estimate of dx1 is significantly larger than slope estimate of dx2 by computing their variances. How should I proceed with that in Stata?

          Comment


          • #6
            Originally posted by Maarten Buis View Post
            A graph is a statistical comparison, and a very good one.

            I suspect you want a test. This will require a model. So your next step is to decide what model you want. This is a substantive decision, so that decision can only be made by you. We can help you with how to implement such decisions, but only you can make substantive decisions for your analysis.

            The other method I was thinking of was to make a linear regression model for each dx. Then making a new variable representing percent change per year for the number of hospitalizations in each year (by using the models' slopes). Eventually, getting a mean of the new variable to represent average percent change of number of hospitalizations for each disease. Something like below:


            Code:
            regress dx1 year
            regress dx2 year
            
            gen percent_change_1=(model 1 coefficient)*100/dx1
            gen percent_change_2=(model 2 coefficient)*100/dx2
            
            mean percent_change_1
            mean percent_change_2

            Is this acceptable? Can you think of methodological problems with this approach?

            Comment


            • #7
              Any ideas about above approach?

              Comment

              Working...
              X