Announcement

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

  • Coefficient plot for a Between-Within model, xthybrid

    Dear Statalist,

    I need you help with creating a coefficient plot after using the command xthybrid (Perales/Schunck) . My goal is to show within- and between coefficients so that they can be compared. I find that it would be best to have them in the same row. If I put them below each other the figure becomes very long on the vertical axis as my final model has many more variables than the example below.

    I tried to "trick" Stata/SE 18 into doing so by running the same model twice and give it different names, but was not succesfull (see below).

    Code:
    eststo within: xthybrid inconsistency3c_d1 agegroup1_1 agegroup1_2 agegroup1_3 agegroup1_4 haskids if female==1 , vce(robust) clusterid(id) family(gaussian) link(identity) full  
    eststo between: xthybrid inconsistency3c_d1 agegroup1_1 agegroup1_2 agegroup1_3 agegroup1_4 haskids if female==1 , vce(robust) clusterid(id) family(gaussian) link(identity) full  
    
    coefplot (within, drop(B__* _cons)) ||    ///
             (between, drop(W__* _cons)), xline(0) scheme(s2mono) graphregion(lwidth(none) fcolor(white))
    Here is the coef plot I get
    Click image for larger version

Name:	testgraph.png
Views:	2
Size:	25.4 KB
ID:	1734184

    The problem is that the within- and between coefficients have different names, which is why they cant be in the same row.

    I am sure there could be other approaches. If you have any idea on how I can accomplish what I need I would very much appreaciate your suggestions.

    Jasmin

  • #2
    I am no expert and not sure if this is a test post and you don't actually want an answer, but I believe you can use the order option to achieve this.
    coefplot (within, drop(B__agegroup1_1 B__agegroup1_2 B__agegroup1_3 B__agegroup1_4 _cons) order(W__agegroup1_1 W__agegroup1_2 W__agegroup1_3 W__agegroup1_4)) || /// (between, drop(W__agegroup1_1 W__agegroup1_2 W__agegroup1_3 W__agegroup1_4 _cons) order(B__agegroup1_1 B__agegroup1_2 B__agegroup1_3 B__agegroup1_4)), xline(0) scheme(s2mono) graphregion(lwidth(none) fcolor(white))

    Comment


    • #3
      I was definitely wrong about this, and saw you had posted in the main forum and gotten a correct answer. Apologies!

      Comment

      Working...
      X