Hi there,
I am having issues with a twoway kdensity plot on which I would like to superimpose either a line or a point representing the median (by country).
I am working with Stata 18 and my dataset is a subset of the ESS (European Social Survey).
Following what has been said in other posts on the topic I coded the following:
Then, I am stuck with the following twoway kdensity code where I do not know to add the abovementioned value (let's say in the form of a line):
I previously tried to use the xline() graph option, yet it appears to me it is only worth it when you insert the exact value.
Thanks in advance
Mattia
I am having issues with a twoway kdensity plot on which I would like to superimpose either a line or a point representing the median (by country).
I am working with Stata 18 and my dataset is a subset of the ESS (European Social Survey).
Following what has been said in other posts on the topic I coded the following:
Code:
egen median_Redistribution_norm=median(Redistribution_norm), by(cntry) /// to create a variable containing the median value for my variable "Redistribution_norm" for each country
Code:
twoway kdensity Red, bw(0.2) title(Redistribution Policy) range(0 1) xlabel(0 "Left" 1 "Right") by(cntry)
Thanks in advance
Mattia
Comment