Announcement

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

  • Graphing different variations of x variable age [age_squared; ln(age); age] on one graph

    Hello,

    Does anyone know how to recreate this graph (image attached) through Stata?

    I am basically trying to plot the three regressions (that have a different variations of the predictor X variable age) on one graph:


    Regression 1, which is represented by the black line on the graph:

    reg ln_AHE age if female==0 & bachelor==0, robust level(95)

    Regression 1 line equation: ln_AHE = 1.9 + .027age



    Regression 2, which is represented by the blue dashed line on the graph:

    reg ln_AHE ln_age if female==0 & bachelor==0, robust level(95)

    Regression 2 line equation: ln_AHE = -0.003 + 0.80ln_age



    Regression 3, which is represented by the red line on the graph:

    reg ln_AHE ln_age age_squared if female==0 & bachelor==0, robust level(95)

    Regression 3 line equation: ln_AHE = 2.7 + -0.029age + .001age_squared



    I attempted this:

    graph twoway (scatter ln_AHE age) (lfit ln_AHE age if female==0 & bachelor==0) (qfit ln_AHE ln_age if female==0 & bachelor==0) (qfit ln_AHE age age_squared if female==0 & bachelor==0)

    But this results in only one of the lines being correctly graphed (line 1 from regression 1) because the other two regressions require a different variation of the x axis age (e.g. ln_age).

    Any advice would be highly appreciated.

    Thanks
    Click image for larger version

Name:	graph_recreate.jpg
Views:	1
Size:	277.1 KB
ID:	1480698
Working...
X