Quantcast
Channel: Statalist
Viewing all articles
Browse latest Browse all 65609

Question: Plotting two overlaid frequency bar charts

$
0
0
Hi all,

I am comparing the distributions of variables in two groups. For numeric variables I do something like this:

/* Generate a dummy variable and a test variable with different distributions per dummy value */
gen dummy = floor(runiform()*2)
gen test = runiform()
replace test = rnormal(0.5,0.1) if dummy==1

/* Overlays both distributions in the same chart */
kdensity test if dummy == 1, plot(kdensity test if dummy == 0) legend(label(1 "Dummy is 1") label(2 "Dummy is 0") rows(1))


I have other variables that are not numeric, like country, city, etc; and would like to have a similar chart than above using the frequencies. Any ideas?

Thanks in advance.

Viewing all articles
Browse latest Browse all 65609

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>