Announcement

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

  • Coefplot - option rename()

    Dear statalist members,

    in fact, I have got three questions concerning coefplot (Ben Jann, 2014) but the main question deals with rename().
    I plot four models with AME for two waves using the following code:

    Code:
    coefplot (SE1, label(Settler)) (TE1, label(Target earner)) (YL1, label(Young & Learning)) ///
             (FR1, label(Family remigrants)), bylabel(Wave 1) ///
             || (SE2, label(Settler)) (TE2, label(Target earner)) (YL2, label(Young & Learning)) ///
             (FR2, label(Family remigrants)), bylabel(Wave 2) ///
             ||, rename(ident2 = ident1 PPRC2 = PPRC1 LANG2 = LANG1 ACT2 = ACT1) ///
             drop (durStay1 durStay2 age1 age2 *.sex) legend(row(2)) ///
             xline(0) ///
     coeflabels(ident1 = "{bf:Identification with Germany}" PPRC1 = "{bf:Time spent with Germans}" LANG1 = "{bf:Language proficiency}" ///
     , labsize(small)) legend(size(small)rows(2)) xlabel(,labsize(small)) ///
     headings(1.ACT* = `""{bf:Employment status}" "{it:(Ref.: unemployed)}""' ///
              2.motive = `""{bf:Migration motive}" "{it:(Ref.: Family)}""' ///
              1.EG = `""{bf:Ethnic group}" "{it:(Ref.: Poles)}""')
    This is my result:

    Click image for larger version

Name:	AME_w1_w2_bp.png
Views:	1
Size:	44.7 KB
ID:	1490868


    #1:
    As ACT* (employment status) is measured in wave1 and wave2 there are different variable names in the wave 1 (ACT1) and wave 2 (ACT2) models.
    That's why employment status is the last coefficient in the second subgraph - at first glance.
    I tried to fix the problem, also for identification (ident*), time spent with Germans (PPRC*) and language proficiency (LANG*), by
    Code:
    rename
    .
    It worked for all coefficients except ACT*. I have no clue why this is the case.

    #2:
    How can I change the font size of the reference categories (part of the heading which is in italics)?

    #3:
    How can I change the size of the gaps between the first three coefficients? I know the code is
    Code:
    gap
    , but I don't know where to put it in my code and how to specify the coefficients.

    Thank you for any suggestions.


  • #2
    I fixed problem #3 with:
    Code:
    order(coef . coef .)
    The . inserts gaps between coefficients.

    Problem #1 is still there. Is it a bug?

    Comment


    • #3
      #1
      ACT1/ACT2 seem to be included in the model as factor variables, so the names of the coefficients will be something like 1.ACT1, 2.ACT1, ... 1.ACT2, 2.ACT2 etc. Thus, typing rename(ACT2 = ACT1) will not rename these coefficients. I think rename(*.ACT2 = .ACT1)should work.
      #2
      I don't know.

      Comment


      • #4
        Originally posted by Franziska Spanner View Post
        Dear statalist members,

        in fact, I have got three questions concerning coefplot (Ben Jann, 2014) but the main question deals with rename().
        I plot four models with AME for two waves using the following code:

        Code:
        coefplot (SE1, label(Settler)) (TE1, label(Target earner)) (YL1, label(Young & Learning)) ///
        (FR1, label(Family remigrants)), bylabel(Wave 1) ///
        || (SE2, label(Settler)) (TE2, label(Target earner)) (YL2, label(Young & Learning)) ///
        (FR2, label(Family remigrants)), bylabel(Wave 2) ///
        ||, rename(ident2 = ident1 PPRC2 = PPRC1 LANG2 = LANG1 ACT2 = ACT1) ///
        drop (durStay1 durStay2 age1 age2 *.sex) legend(row(2)) ///
        xline(0) ///
        coeflabels(ident1 = "{bf:Identification with Germany}" PPRC1 = "{bf:Time spent with Germans}" LANG1 = "{bf:Language proficiency}" ///
        , labsize(small)) legend(size(small)rows(2)) xlabel(,labsize(small)) ///
        headings(1.ACT* = `""{bf:Employment status}" "{it:(Ref.: unemployed)}""' ///
        2.motive = `""{bf:Migration motive}" "{it:(Ref.: Family)}""' ///
        1.EG = `""{bf:Ethnic group}" "{it:(Ref.: Poles)}""')
        Thank you so much! Your code helped a lot when I was trying to figure out how to add/edit the legend labels in the coefplot!

        Comment

        Working...
        X