Announcement

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

  • Meta-Forest plot sub-group variable label help

    Dear all,

    I must confess that I am lost at the abundance of options in meta-forestplot. When run the forestplot command with subgroup option, the graph produces with taking the variable name as the sub-group title while I intend to have the variable lable instead. What option there is to achieve this without using the graph editor? Any help is appreciated. Please see the example below for demo:

    Code:
    clear
    webuse bcg, clear
    
    ***create a group based on latitude**
    summ latitude, meanonly
    
    label def clathigh 0 "Below average lat." 1 "Above average lat."
    gen byte lathigh = latitude > r(mean)
    label values lathigh clathigh
    
    *****label two variables to be used as sub-groups*****
    
    lab var alloc "Random allocation"
    lab var lathigh "High latitude"
    des alloc lathigh
    
    ***Declare meta data****
    
    meta esize npost nnegt nposc nnegc, esize(lnrratio)
    
    ***Forest plot with subgroups****
    
    //Here I want "Random allocation" the variable label instead variable name and same for 'latitude'
    
    meta forestplot, subgroup(alloc lathigh)

    Click image for larger version

Name:	test.png
Views:	2
Size:	117.7 KB
ID:	1765496
    Attached Files
    Roman

  • #2
    Strange that I can't see my post in the front page but it is available in my profile under "All started topic". So commenting to see if it appears in the front page.

    PS: It appeared now after commenting!
    Roman

    Comment


    • #3
      I do not know of an option, but you could automate the graph editor.

      Code:
      clear
      webuse bcg, clear
      
      ***create a group based on latitude**
      summ latitude, meanonly
      
      label def clathigh 0 "Below average lat." 1 "Above average lat."
      gen byte lathigh = latitude > r(mean)
      label values lathigh clathigh
      
      *****label two variables to be used as sub-groups*****
      
      lab var alloc "Random allocation"
      lab var lathigh "High latitude"
      des alloc lathigh
      
      ***Declare meta data****
      
      meta esize npost nnegt nposc nnegc, esize(lnrratio)
      
      ***Forest plot with subgroups****
      
      //Here I want "Random allocation" the variable label instead variable name and same for 'latitude'
      
      meta forestplot, subgroup(alloc lathigh) 
      
      local i 0
      foreach var in alloc lathigh{
          local ++i
          .Graph.plotregion1.column1.group_items[`i'].text = {}
          .Graph.plotregion1.column1.group_items[`i'].text.Arrpush {bf:`:var lab `var''}
      }
      .Graph.drawgraph
      Click image for larger version

Name:	Graph.png
Views:	1
Size:	31.1 KB
ID:	1765529

      Comment


      • #4
        You are amazing! Thank you Andrew.
        Roman

        Comment

        Working...
        X