Announcement

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

  • Post-regression graph with estimation of linear trend in multiple age-indicator variables

    Hi all,

    I have data on people moving from one place to another at different ages during childhood. I run a regression like this:

    areg child_income_rank treatment_age9 treatment_age10 treatment_age11 ... treatment_age18, a(control variables)

    where the treatment_ageX is an interaction between a treatment and the indicator of age that is equal to 1 if age = X and zero otherwise.

    The regression produces something like:

    Variable coefficient
    treatment_age 9 0.9
    treatment_age 10 0.7
    treatment_age 11 0.8
    treatment_age 12 0.4
    treatment_age 13 0.5
    treatment_age 14 0.5
    treatment_age 15 0.4
    treatment_age 16 0.3
    treatment_age 17 0.2
    treatment_age 18 0.3


    After the regression, I would like to draw a graph similar to the one attached with both the scatterplot, a linear trendline, and a slope equation.

    How do I make that post-regression code?

    Unfortunately, I am working on a secure server and cannot provide any data.

    Best regards,

    Matthew
    Attached Files

  • #2
    You'll increase your chances of a useful answer by following the FAQ on asking questions - provide Stata code in code delimiters, readable Stata output, and sample data using dataex. If you can't use the real data, generating an example that highlights the problem would also work.

    I don't do graphs this fancy. If you can't do it otherwise with margins, you can write the parameters into a new variable and then use that with twoway to generate graphs. You'll need to have two lines on the graph to get the break at 24.

    Comment

    Working...
    X