Hi all, I'd like to obtain 95% CIs for a variable with 3 categories - male, female, and unknown; over several years. Some of the same individuals are found in multiple years. To do this, I use proportion, vce(cluster person) where person is the ID for the individual person, and citype(wilson) to obtain Wilson confidence intervals.
Is there anything obviously wrong with this approach, or anything you would do differently?
Note: I'm using Stata 15.
Is there anything obviously wrong with this approach, or anything you would do differently?
Note: I'm using Stata 15.
Code:
. proportion gender_n, vce(cluster person) over(year) citype(wilson) percent
Proportion estimation Number of obs = 15,134
F: gender_n = F
M: gender_n = M
U: gender_n = U
2007: year = 2007
2008: year = 2008
2009: year = 2009
2010: year = 2010
2011: year = 2011
2012: year = 2012
2013: year = 2013
(Std. Err. adjusted for 8,237 clusters in person)
--------------------------------------------------------------
| Robust Wilson
Over | Percent Std. Err. [95% Conf. Interval]
-------------+------------------------------------------------
F |
2007 | 59.85 1.17 57.55 62.12
2008 | 65.17 1.00 63.18 67.10
2009 | 69.34 0.81 67.73 70.90
2010 | 71.12 0.96 69.20 72.96
2011 | 67.63 1.04 65.57 69.62
2012 | 71.09 0.96 69.16 72.94
2013 | 66.56 1.32 63.93 69.09
-------------+------------------------------------------------
M |
2007 | 16.55 0.88 14.89 18.36
2008 | 19.97 0.84 18.38 21.67
2009 | 23.90 0.75 22.46 25.40
2010 | 20.63 0.86 19.00 22.36
2011 | 24.71 0.95 22.88 26.62
2012 | 22.14 0.89 20.46 23.93
2013 | 26.81 1.24 24.46 29.30
-------------+------------------------------------------------
U |
2007 | 23.59 1.01 21.67 25.62
2008 | 14.86 0.74 13.46 16.38
2009 | 6.76 0.44 5.95 7.68
2010 | 8.26 0.58 7.19 9.47
2011 | 7.67 0.59 6.59 8.90
2012 | 6.77 0.53 5.80 7.89
2013 | 6.63 0.69 5.39 8.12
--------------------------------------------------------------

Comment