Hello everyone,
Using Stata 18.5, I've used triplot by Nick Cox (2009) in order to plot three discrete variables, each ranging from 0(0.1)1.
Since my variables are discrete, when using triplot many observations lie on top of each other. Using a semi-transparent color for mcolor helps to visualize this, but what I'd prefer is to adjust the size of the markers according to how frequent each combination of values for the three variables is.
Afaik this cannot be directly implemented in triplot. Does anyone have an idea?
My (very rudimentary) idea: Is there maybe a way to contract my three variables, then generate x- & y-variables that reflect the location that an observation would've had in the triplot, and then plot a twoway scatter x y with [frequency = freq] + plot the ternary axes?
Thank you so much in advance!
Using Stata 18.5, I've used triplot by Nick Cox (2009) in order to plot three discrete variables, each ranging from 0(0.1)1.
Since my variables are discrete, when using triplot many observations lie on top of each other. Using a semi-transparent color for mcolor helps to visualize this, but what I'd prefer is to adjust the size of the markers according to how frequent each combination of values for the three variables is.
Afaik this cannot be directly implemented in triplot. Does anyone have an idea?
My (very rudimentary) idea: Is there maybe a way to contract my three variables, then generate x- & y-variables that reflect the location that an observation would've had in the triplot, and then plot a twoway scatter x y with [frequency = freq] + plot the ternary axes?
Code:
* Example generated by -dataex-. For more info, type help dataex clear input float(belief1 belief2 belief3) .3 .4 .3 0 .4 .6 .3 .6 .1 .5 .2 .3 .2 .5 .3 .1 .1 .8 .3 .6 .1 .6 .1 .3 .8 0 .2 .5 .3 .2 .3 .2 .5 .1 .6 .3 .4 .3 .3 .6 .3 .1 .2 .5 .3 .4 .3 .3 .4 .5 .1 .3 .5 .2 .3 .4 .3 .6 .3 .1 .6 .2 .2 .1 .4 .5 .5 .3 .2 0 .5 .5 .5 .3 .2 .3 .4 .3 .3 .4 .3 .6 .2 .2 .4 .3 .3 .3 .3 .4 end triplot belief1 belief2 belief3, mcolor(blue%30) msymbol(O) mlcolor(none) // not happy with the fact that only the intensity of the marker color shows how some observations share the same distribution for the three variables contract belief1 belief2 belief3
Thank you so much in advance!
Comment