Announcement

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

  • Overlaying multiple density plots

    Hi


    I have a set of data on firms from 5 different regions. For each firm, I know % of their credit that comes from bank overdrafts. I'd like to plot kdensity of this % by region all on one chart. To do this, I use the syntax below (from here - http://www.stata.com/manuals13/rkdensity.pdf) just changing foreign to region. For some reason, area underneath one of the curves looks much smaller than others. What could be the reason for this?

    Thanks
    Tamara . use http://www.stata-press.com/data/r13/auto, clear
    (1978 Automobile Data)
    . kdensity weight, nograph generate(x fx)
    . kdensity weight if foreign==0, nograph generate(fx0) at(x)
    . kdensity weight if foreign==1, nograph generate(fx1) at(x)
    . label var fx0 "Domestic cars"
    . label var fx1 "Foreign cars"
    . line fx0 fx1 x, sort ytitle(Density)
Working...
X