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.
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.