Announcement

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

  • replicate coefplot style

    Hi,

    I need to replicate coefplot (from SSC) graph style, including the zero line, using this simple dataset, :

    Code:
    clear
    input str12 var float(coef lowerBound upperBound)
    "kpi1"   .675  .5073 .8439
    "kpi2" .444  .1856 .7027
    "kpi3"  .122 -.1344 .3788
    end
    Click image for larger version

Name:	OIP (1).jpg
Views:	1
Size:	8.5 KB
ID:	1773475



    thanks in advance

  • #2
    Code:
    clear
    input str12 var float(coef lowerBound upperBound)
    "kpi1"   .675  .5073 .8439
    "kpi2" .444  .1856 .7027
    "kpi3"  .122 -.1344 .3788
    end
    
    mkmat coef lowerBound upperBound, mat(coefs) rownames(var)
    mat coefs= coefs'
    coefplot mat(coefs),ci((2 3)) xline(0)
    Click image for larger version

Name:	Graph.png
Views:	1
Size:	17.2 KB
ID:	1773478

    Comment


    • #3
      Note also

      Code:
      clear
      input str12 var float(coef lowerBound upperBound)
      "kpi1"   .675  .5073 .8439
      "kpi2" .444  .1856 .7027
      "kpi3"  .122 -.1344 .3788
      end
      
      gen y = _n
      
      scatter y coef || rspike lower upper y, horizontal ysc(reverse) ///
      yla(1 "kpi1" 2 "kpi2" 3 "kpi3", tlc(none)) ytitle("") xline(0) legend(off)
      A tiny variation on what is common in this code is making the ticks themselves invisible. I don't understand that ticks on a categorical axis are either needed or helpful.

      Comment

      Working...
      X