Announcement

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

  • Histogram with density of 15??

    Hi everyone,

    I would like to know if I'm doing something wrong.

    I am running almost 200 regressions basically and collecting the coefficients for each one over all of them, so that I have a .dta which consists solely of the b_ of the variables. I've succeeded in doing this, here is an example of my data for vark:

    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input float b_vark
     3.396698
     3.379129
    3.4008584
    3.4163265
     3.407227
    3.3611805
     3.410911
      3.40948
    3.4045825
     3.382801
     3.405709
     3.418393
     3.411751
     3.360613
     3.416084
     3.410531
     3.406611
     3.385547
     3.394252
     3.389984
      3.33743
     3.396989
      3.38991
     3.384635
     3.424929
    3.4166055
     3.357182
    3.4244335
      3.41926
     3.410072
     3.429587
     3.371039
     3.437761
    3.4308956
    3.4213645
     3.359139
     3.425608
    3.4222975
     3.413559
     3.372591
      3.36899
     3.363826
     3.431501
    3.4220905
      3.42228
     3.370989
     3.391934
    3.4071674
     3.399939
     3.358832
       3.4016
     3.397689
     3.397151
     3.376958
    3.3882046
     3.383614
    3.3409314
     3.388817
    3.3837104
     3.380788
    3.4201446
    3.4101994
     3.361287
      3.41551
    3.4127526
    3.4071155
     3.426149
     3.378766
     3.432141
     3.427403
     3.421279
     3.366856
      3.42038
     3.419267
    3.4132764
    3.3793986
    3.3773935
    3.3731976
     3.426004
    3.4197905
     3.421866
    3.3825076
     3.391777
     3.388213
     3.340173
     3.393364
      3.38452
     3.383398
     3.422355
    3.4159694
     3.360905
     3.421646
     3.414381
     3.409625
     3.429239
    3.3763766
     3.435365
     3.427185
     3.422666
     3.366118
    end
    However, when trying to create a histogram to check the variability of each one, I ran across into a problem which is the fact that my histogram density isn't within one, but goes over 15.

    Code:
    histogram b_vark
    Click image for larger version

Name:	Screenshot 2020-10-30 at 21.38.26.png
Views:	2
Size:	35.2 KB
ID:	1579665

    Am I doing something wrong?

    Just another question while I'm at it: the coefplot command (SSC, I think), doesn't work in this case right? I thought since these are regression coeficients it would look well presented all together, but it only presents me with the coefficient of the last regression and respective confidence interval it seems.

    Sorry if my questions are fairly basic. Please forgive a fellow Stata beginner.

    Thank you
    Attached Files

  • #2
    You're not doing anything wrong. The vertical axis is labeled density, and density ranges from 0 to infinity, not 0 to 1. The defining characteristic of density is that the area under the histogram will be 1.0 Since the horizontal axis in your case has a very narrow range, it is not surprising that the vertical axis extends very high.

    If you prefer to have your vertical axis scaled to probabilities (0-1) rather than density, then specify the -fraction- option. Or if you would like percentages (0-100%) you can specify the -percent- option.

    I don't use -coefplot- myself, so I can't help you with that. I hope somebody else will answer that part of your question.

    Comment


    • #3
      As Clyde Schechter says, the densities are correct.

      Apply a rectangle approximation:

      total width of histogram (units of outcome) TIMES average bar height (1 / units of outcome) = 1 (total probability; no units)

      As the total width of the histogram is rather more than 0.1, the average bar height should be a bit less than 10, which checks out

      Comment


      • #4
        Thank you so much! Your answers made everything more clear, thank you

        Comment

        Working...
        X