Greetings,
I'm running Stata 15.1 and using longitudinal data from the General Social Survey. I'd like to graph the average number of male sex partners by political ideology and overtime. I created a weighted/by-year variables that store the mean # of sex partners for liberal, conservative, and all women, respectively. I then generated a line chart with the following syntax:
.
However, I'd now like to add confidence intervals for each of these y variables but am unsure how to do so. Any help would be much appreciated. Thanks in advance!
Here's my data:
I'm running Stata 15.1 and using longitudinal data from the General Social Survey. I'd like to graph the average number of male sex partners by political ideology and overtime. I created a weighted/by-year variables that store the mean # of sex partners for liberal, conservative, and all women, respectively. I then generated a line chart with the following syntax:
Code:
twoway (line mensex_all mensex_lib mensex_con nummen_year, sort(nummen_year))
However, I'd now like to add confidence intervals for each of these y variables but am unsure how to do so. Any help would be much appreciated. Thanks in advance!
Here's my data:
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input float(mensex_all mensex_lib mensex_con nummen_year) . . . 1989 . . . 1989 . . . 1989 . . . 1989 . . . 1989 3.253476 4.3462496 . 1989 . . . 1989 3.253476 . . 1989 . . . 1989 . . . 1989 3.253476 4.3462496 . 1989 3.253476 . . 1989 . . . 1989 3.253476 . . 1989 3.253476 . . 1989 3.253476 . . 1989 3.253476 . . 1989 3.253476 . . 1989 3.253476 . . 1989 3.253476 . . 1989 3.253476 . 2.9069505 1989 . . . 1989 3.253476 . . 1989 . . . 1989 . . . 1989 3.253476 . 2.9069505 1989 3.253476 4.3462496 . 1989 . . . 1989 3.253476 . 2.9069505 1989 . . . 1989 3.253476 . 2.9069505 1989 3.253476 . . 1989 3.253476 4.3462496 . 1989 3.253476 . 2.9069505 1989 3.253476 4.3462496 . 1989 . . . 1989 3.253476 . . 1989 . . . 1989 . . . 1989 3.253476 4.3462496 . 1989 . . . 1989 3.253476 . . 1989 3.253476 . . 1989 3.253476 . . 1989 3.253476 4.3462496 . 1989 . . . 1989 3.253476 . . 1989 3.253476 . 2.9069505 1989 . . . 1989 3.253476 . . 1989 end
Comment