Announcement

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

  • Weighting by how often something shows up

    I am trying to weight areas of a twoway scatter by how frequent they show up.
    For instance
    scatter var1 var2

    Say I have many observations that show up at the point (1,1) on my scatter plot, but not that many that are at (0,0). I want to make giant hollow circles but they should be much bigger at (1,1) since there are lots more observations at that point. Can you help?
    Thanks!

  • #2
    Maybe this example will point you in the right direction.
    Code:
    clear
    input y x
    0 0
    1 1
    1 1
    1 1
    1 1
    1 1
    2 2
    2 2
    end
    
    preserve
    contract y x
    list, noobs
    scatter y x [w=_freq], msymbol(Oh)
    restore
    Code:
    . list, noobs
    
      +---------------+
      | y   x   _freq |
      |---------------|
      | 0   0       1 |
      | 1   1       5 |
      | 2   2       2 |
      +---------------+
    Click image for larger version

Name:	Graph.png
Views:	1
Size:	33.9 KB
ID:	1522708

    Comment

    Working...
    X