How to visualize cluster data in a scatter way

Having a clustered dataset, I want to visualize a scatter plot for two fields so every cluster is shown on the plane by its mean value (also good to have a radius equal to std). How does one do this in Stata?

• If you have (x,y) points, which std do you want to use? – Dimitriy V. Masterov Oct 16 '14 at 17:57
• Are you simply asking for Stat code? – gung - Reinstate Monica Oct 16 '14 at 18:45

Here's an example with the auto data that uses two rings whose areas are proportional to standard deviations, which is not quite what your want, but is fairly easy:

sysuse auto, clear
collapse (mean) price mpg (sd) sd_price = price sd_mpg = mpg, by(rep78)

tw (scatter price mpg [w=sd_price], ms(Oh)) (scatter price mpg [w=sd_mpg], ms(Oh)) (scatter price mpg, msymbol(none) mlabpos(0) mlabel(rep78)), legend(off)


The missing group corresponds to "."

This way of plotting the data does not seems like a good idea, as it obscures some features of the data. For instance, you get the sense that SD of price is larger than SD of MPG, but for group 1, the former is 200 times the latter, though the bubbles appear the same size.

• May be you are right regarding the plot representation. The key new thing there is the collapse command. It saved my day – Kirill Lykov Oct 16 '14 at 19:57