Announcement

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

  • Help with xtreg, splines and trends?

    Hi all, since my last post I have read the FAQs and so this should be a better post;

    Now, I am doing a research paper on the effects of economic crisis on mental health problems in Russia.

    As such, I have age specific (5 year groups) mortality data (by cause) on Russia from 1980 to 2000, and the causes are divided into 3: suicide rate, chronic alcoholism and "other psychoses" (ICD 9/10)

    The initial variables were then: Age Group, Year, Suicide Rate, Chronic Alcoholism and Other Psychoses: for the rest of this post I focus on the trends of Suicide Rate

    After uploading the data to Stata, I used
    Code:
    egen panel =group(AgeGroup)
    to create a panel based on the Age Group and then used
    Code:
    xtset panel Year
    to define my data as panel data.

    After this, I created 2 dummy variables, afterfall and aftercrisis. afterfall is a dummy=1 after 1991 (after the fall of the Soviet Union) and aftercrisis is a dummy=1 after 1997 (after the start of the Ruble crisis)

    I then ran
    Code:
    xtreg SuicideRate Year afterfall i.panel,re
    and
    Code:
    xtreg SuicideRate Year aftercrisis i.panel,re
    to check the magnitude of the effects of the trend breaks.

    A question here: what exactly would be the meaning of the coefficients attched to Year and afterfall/aftercrisis in these regressions? Also, since I used
    Code:
    i.panel,re
    its shows coefficients for each panel: what do these coefficients mean?

    Anyway, after this, I wanted to check the what the trend was after and before the two breaks: and so I created splines using
    Code:
    mkspline prereform 11 reform 17 crisis = time
    , so the splines would break the data from 1980 to 1991 and then 1992 to 1997 and then 1998 to 2000: therefore three new spline variables are formed: prereform, reform and crisis

    However I am quite unsure of what regression to use now to check the difference in trends before and after the crisis: would I use
    Code:
    xtreg SuicideRate prereform reform crisis aftercrisis
    or individually do them two splines at a time to get the trend before/after the fall and before/after the crisis like this
    Code:
    xtreg SuicideRate prereform reform afterfall
    and
    Code:
    xtreg SuicideRate reform crisis aftercrisis
    ???

    Also, how do I check for the trends in each age group before and after the fall and the crisis?


    My data looks like this:

    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input str6 AgeGroup int(Year SuicideRate ChronicAlcoholism OtherPsychoses) float(panel afterfall aftercrisis time) byte(prereform reform crisis)
    "15to19" 1980  225   1  1 1 0 0  0  0 0 0
    "15to19" 1981  222   0  2 1 0 0  1  1 0 0
    "15to19" 1982  225   1  2 1 0 0  2  2 0 0
    "15to19" 1983  221   0  1 1 0 0  3  3 0 0
    "15to19" 1984  228   0  1 1 0 0  4  4 0 0
    "15to19" 1985  202   0  1 1 0 0  5  5 0 0
    "15to19" 1986  163   0  2 1 0 0  6  6 0 0
    "15to19" 1987  160   0  1 1 0 0  7  7 0 0
    "15to19" 1988  183   0  1 1 0 0  8  8 0 0
    "15to19" 1989  185   0  1 1 0 0  9  9 0 0
    "15to19" 1990  235   0  2 1 0 0 10 10 0 0
    "15to19" 1991  242   0  1 1 0 0 11 11 0 0
    "15to19" 1992  254   0  2 1 1 0 12 11 1 0
    "15to19" 1993  323   1  2 1 1 0 13 11 2 0
    "15to19" 1994  354   0  1 1 1 0 14 11 3 0
    "15to19" 1995  366   1  1 1 1 0 15 11 4 0
    "15to19" 1996  351   1  1 1 1 0 16 11 5 0
    "15to19" 1997  347   0  1 1 1 0 17 11 6 0
    "15to19" 1998  335   1  2 1 1 1 18 11 6 1
    "15to19" 1999  339  12  1 1 1 1 19 11 6 2
    "15to19" 2000  363  16  0 1 1 1 20 11 6 3
    "20to24" 1980  540   2  3 2 0 0  0  0 0 0
    "20to24" 1981  494   4  3 2 0 0  1  1 0 0
    "20to24" 1982  526   3  2 2 0 0  2  2 0 0
    "20to24" 1983  478   2  2 2 0 0  3  3 0 0
    "20to24" 1984  513   4  3 2 0 0  4  4 0 0
    "20to24" 1985  436   3  3 2 0 0  5  5 0 0
    "20to24" 1986  311   2  1 2 0 0  6  6 0 0
    "20to24" 1987  288   1  1 2 0 0  7  7 0 0
    "20to24" 1988  298   0  2 2 0 0  8  8 0 0
    "20to24" 1989  332   0  1 2 0 0  9  9 0 0
    "20to24" 1990  341   3  1 2 0 0 10 10 0 0
    "20to24" 1991  354   1  1 2 0 0 11 11 0 0
    "20to24" 1992  429   1  2 2 1 0 12 11 1 0
    "20to24" 1993  534   4  3 2 1 0 13 11 2 0
    "20to24" 1994  649   6  4 2 1 0 14 11 3 0
    "20to24" 1995  725   5  5 2 1 0 15 11 4 0
    "20to24" 1996  734   5  5 2 1 0 16 11 5 0
    "20to24" 1997  724   6  2 2 1 0 17 11 6 0
    "20to24" 1998  709   4  1 2 1 1 18 11 6 1
    "20to24" 1999  757  27  5 2 1 1 19 11 6 2
    "20to24" 2000  796  35  3 2 1 1 20 11 6 3
    "25to29" 1980  750  20  4 3 0 0  0  0 0 0
    "25to29" 1981  742  24  2 3 0 0  1  1 0 0
    "25to29" 1982  770  21  3 3 0 0  2  2 0 0
    "25to29" 1983  721  19  4 3 0 0  3  3 0 0
    "25to29" 1984  781  17  3 3 0 0  4  4 0 0
    "25to29" 1985  639  14  3 3 0 0  5  5 0 0
    "25to29" 1986  431   6  2 3 0 0  6  6 0 0
    "25to29" 1987  432   5  3 3 0 0  7  7 0 0
    "25to29" 1988  448   3  3 3 0 0  8  8 0 0
    "25to29" 1989  494   4  1 3 0 0  9  9 0 0
    "25to29" 1990  498   7  2 3 0 0 10 10 0 0
    "25to29" 1991  513   6  3 3 0 0 11 11 0 0
    "25to29" 1992  600   8  5 3 1 0 12 11 1 0
    "25to29" 1993  747  21  5 3 1 0 13 11 2 0
    "25to29" 1994  863  31  3 3 1 0 14 11 3 0
    "25to29" 1995  847  31  6 3 1 0 15 11 4 0
    "25to29" 1996  828  19  7 3 1 0 16 11 5 0
    "25to29" 1997  767  13  5 3 1 0 17 11 6 0
    "25to29" 1998  722  11  4 3 1 1 18 11 6 1
    "25to29" 1999  800  42  5 3 1 1 19 11 6 2
    "25to29" 2000  867  56  3 3 1 1 20 11 6 3
    end
    Thank you so much!

  • #2
    Also, since I used
    Code:
    i.panel,re
    its shows coefficients for each panel: what do these coefficients mean?
    They don't mean anything; you shouldn't have done that. You are specifying a random effects regression with -,re- and then also introducing fixed effects for the same variable--that's just a mis-specified model. Discard the results and do it over without i.panel. (Or, if you want fixed effects instead of random, replace -, re- by -, fe-. But either way, eliminate i.panel.

    I then ran
    Code:
    xtreg SuicideRate Year afterfall i.panel,re
    and
    Code:
    xtreg SuicideRate Year aftercrisis i.panel,re
    to check the magnitude of the effects of the trend breaks.
    A question here: what exactly would be the meaning of the coefficients attched to Year and afterfall/aftercrisis in these regressions?
    Well, as already pointed out, because of the mis-specification of the model, none of this means anything. But let's imagine you did this without the i.panel. Then the coefficient of Year represents the expected annual change in suicide rate over the entire period, and the coefficients of afterfall and aftercrisis represent the amount by which the suicide rate jumps in 1991 and 1997. The model stipulates that the annual rate of increase does not change at these times: there is just a jump at that moment in time, and the annual rate continues to apply after that.

    As for your models with the splines, you should use -xtreg SuicideRate prereform reform crisis aftercrisis-,

    Also, how do I check for the trends in each age group before and after the fall and the crisis?
    I don't understand this question. Please explain what you are looking for here. What does "check for trends" mean?


    Comment


    • #3
      Originally posted by Clyde Schechter View Post
      They don't mean anything; you shouldn't have done that. You are specifying a random effects regression with -,re- and then also introducing fixed effects for the same variable--that's just a mis-specified model. Discard the results and do it over without i.panel. (Or, if you want fixed effects instead of random, replace -, re- by -, fe-. But either way, eliminate i.panel.


      Well, as already pointed out, because of the mis-specification of the model, none of this means anything. But let's imagine you did this without the i.panel. Then the coefficient of Year represents the expected annual change in suicide rate over the entire period, and the coefficients of afterfall and aftercrisis represent the amount by which the suicide rate jumps in 1991 and 1997. The model stipulates that the annual rate of increase does not change at these times: there is just a jump at that moment in time, and the annual rate continues to apply after that.
      I see, okay that makes sense, thank you so much; so using it without i.panel I'm now using the code
      Code:
      xtreg SuicideRate Year afterfall,re
      Thank you for this!

      You said that the coefficient of afterfall and aftercrisis only show jumps in 1991 and 1997; I guess this is not then an efficient way of seeing if there was a change in the suicide trends

      When I use my model with splines, -xtreg SuicideRate prereform reform crisis aftercrisis-, do the coefficients for prereform, reform and crisis show the annual change in suicide for the three periods? Also, if I change aftercrisis with afterfall, what would this exactly mean in the model?

      Thanks!

      Comment


      • #4
        You said that the coefficient of afterfall and aftercrisis only show jumps in 1991 and 1997; I guess this is not then an efficient way of seeing if there was a change in the suicide trends
        No, it is not any way to do that at all. They only show one-time jumps, they say nothing at all about trends over periods of time.

        When I use my model with splines, -xtreg SuicideRate prereform reform crisis aftercrisis-, do the coefficients for prereform, reform and crisis show the annual change in suicide for the three periods?
        You have to choose your words carefully. They show the annual change in the suicide rate during those periods.

        Also, if I change aftercrisis with afterfall, what would this exactly mean in the model?
        I don't understand what you mean by that. I don't know which of the several models you have proposed you have in mind, nor do I understand what "change aftercrisis with afterfall" is.

        Comment


        • #5
          Originally posted by Clyde Schechter View Post
          No, it is not any way to do that at all. They only show one-time jumps, they say nothing at all about trends over periods of time.
          Thank you! Do you reckon my spline model -xtreg SuicideRate prereform reform crisis aftercrisis- does a better job of this? If not, what would you use to analyse trends over time periods?

          I don't understand what you mean by that. I don't know which of the several models you have proposed you have in mind, nor do I understand what "change aftercrisis with afterfall" is.
          Sorry I should have been clearer- I mean in my spline reg -xtreg SuicideRate prereform reform crisis aftercrisis- , what does the coefficient of aftercrisis tell me; and if I change this to afterfall using -xtreg SuicideRate prereform reform crisis afterfall- , what changes?

          Thank you!

          Comment


          • #6
            Thank you! Do you reckon my spline model -xtreg SuicideRate prereform reform crisis aftercrisis- does a better job of this? If not, what would you use to analyse trends over time periods?
            This is a good model for estimating separate annual rates of change in the suicide rate in the prereform, reform, and crisis eras. It also includes a one time jump in the suicide rate in 1997. So you are modeling a suicide rate that is changing at a certain rate during the pre-reform period, and then at another rate during the reform period. Then in 1997 there is a sudden jump in addition to a change in the rate (since both crisis and aftercrisis refer to the year 1997).

            I mean in my spline reg -xtreg SuicideRate prereform reform crisis aftercrisis- , what does the coefficient of aftercrisis tell me;
            It tells you the amount by thiwhc the suicide rate jumps in 1997.

            and if I change this to afterfall using -xtreg SuicideRate prereform reform crisis afterfall- , what changes?
            In this case, afterfall and reform both refer to the year 1991. So this model has a certain annual rate of change in the suicide rate up to 1991. Then in 1991 there is both a jump and a change in the annual rate of change in the suicide rate. When we reach 1997, the annual rate of change in the suicide rate changes once again, but this time there is no jump in 1997.

            Added: there are a lot of words in these descriptions, and the words rate and change mean different things in different contexts. I think it helps to visualize these things:

            Click image for larger version

Name:	sr_1.png
Views:	1
Size:	25.1 KB
ID:	1512415
            Click image for larger version

Name:	sr_2.png
Views:	1
Size:	26.1 KB
ID:	1512416
            Click image for larger version

Name:	sr_3.png
Views:	1
Size:	27.3 KB
ID:	1512417

            (The values on the y-axis are just numbers I made up--I have no idea if they have any relationship to actual suicide rates.) Just focus on the shape of the graphs: all of them show a change in 1997, but the change is of a different type in each case, corresponding to your different models.
            Last edited by Clyde Schechter; 15 Aug 2019, 07:29.

            Comment

            Working...
            X