Announcement

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

  • Margins for state-specific linear time trends

    My individual-level data includes an outcome variable (svar) with state (FIPS) pooled across years with background characteristics.

    I first estimate state adjusted scores with controls using margins command

    Code:
    reg svar i.FIPS i.YEAR `cntrls'
    margins FIPS, post
    estimates store mar1, title(Adjusted)
    Next I want to estimate state-specific linear time trend after adjusting for national trend. Is the following code correct, and does the margins command below produce the trend coefficients for each state?

    Code:
    reg svar i.FIPS##c.YEAR `cntrls'
    margins FIPS, post
    estimates store mar2, title(Adjusted trends)

  • #2
    Code:
    reg svar YEAR i.FIPS#c.YEAR `cntrols' , absorb(FIPS)
    margins, dydx(YEAR) over(FIPS)

    the first line gets you the difference in the trends by FIPS.
    the second makes all the computations to get you the actual trend value by FIPS.

    Comment


    • #3
      Thanks, could you shed light on why the term in first line is YEAR and not i.YEAR or c.YEAR? Stata returned "not estimable" with the suggested code.

      Comment


      • #4
        What this does is compute the time trend of the first and then the differences from that trend for each FIPS. The margins gets you the trend for all of them.

        With i.YEAR, you are centering the data on a FIPS before estimating the trend. This means you'll not have a trend for that FIPS since it is being estimated using dummies.

        Comment


        • #5
          I suppose you could detrend the sample with a mean trend first, then work with the detrended series.

          reg svar year , absorb(FIPS)
          predict svar_dt, resid

          Comment


          • #6
            So you're suggesting something like

            Code:
            reg svar YEAR, absorb(FIPS)
            predict svar_dt, resid
            
            reg svar_dt YEAR i.FIPS#c.YEAR `cntrls', absorb(FIPS)
            margins, dydx(YEAR) over(FIPS)
            Unfortunately, the last step is always resulting in "not estimable" margins for each FIPS

            Comment


            • #7

              reg svar YEAR, absorb(FIPS) predict svar_dt, resid reg svar_dt i.FIPS#c.YEAR `cntrls', absorb(FIPS) the coefficients should give you what you want

              Comment

              Working...
              X