Announcement

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

  • Coefplot: Change y-labels for several dependent variables

    Hi all,

    for a project I work with Stata and I have several regression analyses separated for Immigrants and the Majority Society. To better show the coefficients, I created a coefplot with coefplot, but now I have several problems.

    The code is:
    coefplot (Gen1_M) (Gen2_M) (Gen3_M) (Gen4_M) (Gen5_M) (Gen6_M) (Gen7_M) (Gen8_M) (Gen9_M) (Gen10_M), bylabel(Majority Population) ///
    || (Gen1_I) (Gen2_I) (Gen3_I) (Gen4_I) (Gen5_I) (Gen6_I) (Gen7_I) (Gen8_I) (Gen9_I) (Gen10_I), bylabel(Immigrants) ///
    || , keep(*Birth2_F) byopts(legend(off)) xline(0) coeflabels (1.Birth2_F* = "General Birth") ///
    xscale(range(-.2 .4)) xlabel(-.2 (.15) .4) legend(size(vsmall))

    You can finde the coefplot attached below.

    Now I have the following problem: I only have one ylabel, that is for the Variable 1.Birth2_F*, but I have several coefficients, these are my dependent variable. I now want to rename the ylabel and create 10 ylabels for each coefficient of Gen1_* (these are my stored regression models). So what I mean is that instead of "General Birth" i want exactly 10 labels for each of the coefficients.

    My question therefore is: How can i label the yscale to that I geht more labels? So labels for each of the 10 dependent variables.

    I hope you understand what I mean.
    Many thanks
    Attached Files
    Last edited by Philipp Hoffmann; 19 Jan 2024, 07:58.

  • #2
    Could you add the regression code that created the coefficients you want to plot? This might help The List understand what you want.

    Comment


    • #3
      Okay, so e.g. for Gen1_M:
      xtlogit Pid i.Birth2_F c.Age i.Labforce c.P_income i.Partner_status c.Education c.d11107 c.Current_health c.Life_satisfaction i.Year_period i.Anticipation if Immigrant==1, fe
      margins, dydx(Birth2_F) post
      est store Gen1_M

      and for Gen1_I:
      xtlogit Pid i.Birth2_F c.Age i.Labforce c.P_income i.Partner_status c.Education c.d11107 c.Current_health c.Life_satisfaction i.Year_period i.Anticipation if Immigrant==2, fe
      margins, dydx(Birth2_F) post
      est store Gen1_I

      Comment

      Working...
      X