Announcement

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

  • Scatterplot question

    Hello all,

    I'd like to do something on a scatterplot, but I'm not sure if it is possible, since the "x" variable in this case is not numeric.

    Here is a snippet of my data

    Code:
    Sector    HS    SS    US
    FBT    10    8    4
    NMM    9    7    3
    TRE    8    6    2
    HIN    7    5    1
    Now the figures represent the change in wages (in percentage terms) by skill level (HS = Highly Skill; SS = Semi-Skilled; US = Unskilled) by sector.

    What I'd like is to plot a scatterplot with average wage increase on y-axis, and sector on x-axis. So all the three dots for each industry would line up vertically. In other words, all 3 dots would have the same "x" value, but a different y value.

    Kind regards

  • #2
    It can't be done with -scatter-, but you can get the graph you are looking for with -dotplot-
    Code:
    set more off
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input str3 sector byte(hs ss us)
    "FBT" 10 8 4
    "HIN"  7 5 1
    "NMM"  9 7 3
    "TRE"  8 6 2
    end
    
    reshape long @s, i(sector) j(skill_level) string
    rename s wage_change
    dotplot wage_change, over(sector)
    Note: I don't know what else you plan to do with this data, but I recommend keeping it in the long layout that this code puts it in. Almost anything you choose to do in Stata will be easier this way than in the wide layout you started with.

    Also, having put up 129 posts since April of 2014, by now you should know better than to post data the way you did. It took me much longer to wrestle your example into Stata than to solve your problem. On a busier day, I wouldn't have had the time to waste on that. Data examples should be posted using the -dataex- command, as I have done here. Please install it by running -dataex-, read the help file (-help dataex-) for instructions and use it consistently to post example data in the future. Please be considerate of those who want to help you.


    Comment


    • #3
      Hi Clive.

      Thanks for the response. I also note your observation about -dataex- and will use it in the future.

      Thanks!

      Comment

      Working...
      X