I’m trying to estimate the difference in blood pressure between hypertensive and non-hypertensive individuals using a complex survey, but doing so by age-group and gender.
I’m having trouble with the matrix code for outputting the results of my svy command. Here is what I am writing currently:
svyset psu [pweight=samplewt_bp], strata(stratum)
svy , subpop(HTN1) : mean sbp_final, over(sex age5)
Survey: Mean estimation | |||
Number of strata = 2 | Number of obs | = | 5,091 |
Number of PSUs = 258 | Population size | = | 2,439,648 |
Subpop. no. obs | = | 1,645 | |
Subpop. size | = | 703,978.23 | |
Design df | = | 256 | |
Linearized | ||||
Mean | Std. Err. | [95% | Conf. | Interval] |
c.sbp_final@sex#age5 | ||||
1 0 | 136.3088 | 5.042258 | 126.3792 | 146.2384 |
1 30 | 139.3294 | 1.698257 | 135.9851 | 142.6738 |
1 35 | 147.6446 | 2.197222 | 143.3177 | 151.9716 |
1 40 | 144.5797 | 1.80772 | 141.0198 | 148.1395 |
1 45 | 154.1876 | 4.811669 | 144.7121 | 163.6631 |
1 50 | 157.141 | 4.226026 | 148.8188 | 165.4632 |
1 55 | 155.97 | 2.916671 | 150.2263 | 161.7137 |
1 60 | 154.9218 | 3.047789 | 148.9199 | 160.9238 |
1 65 | 158.1695 | 2.623057 | 153.004 | 163.335 |
2 0 | 136.8597 | 2.010842 | 132.8998 | 140.8196 |
2 30 | 138.7637 | 2.321715 | 134.1916 | 143.3358 |
2 35 | 145.7804 | 2.492297 | 140.8723 | 150.6884 |
2 40 | 147.0154 | 2.922702 | 141.2598 | 152.771 |
2 45 | 157.0043 | 3.423124 | 150.2632 | 163.7454 |
2 50 | 159.3642 | 5.456736 | 148.6184 | 170.11 |
2 55 | 154.3976 | 2.330003 | 149.8092 | 158.9861 |
2 60 | 158.9386 | 4.417497 | 150.2393 | 167.6378 |
2 65 | 158.8922 | 3.301328 | 152.3909 | 165.3934 |
matrix M = e(b)
mat li M
M[1,18]
M[1,18] | |||||||
c.sbp_final@ | c.sbp_final@ | c.sbp_final@ | c.sbp_final@ | c.sbp_final@ | c.sbp_final@ | c.sbp_final@ | c.sbp_final@ |
1.sex# | 1.sex# | 1.sex# | 1.sex# | 1.sex# | 1.sex# | 1.sex# | 1.sex# |
0.age5 | 30.age5 | 35.age5 | 40.age5 | 45.age5 | 50.age5 | 55.age5 | 60.age5 |
y1 136.3088 | 139.32943 | 147.64465 | 144.57965 | 154.18764 | 157.14103 | 155.96998 | 154.92182 |
c.sbp_final@ | c.sbp_final@ | c.sbp_final@ | c.sbp_final@ | c.sbp_final@ | c.sbp_final@ | c.sbp_final@ | c.sbp_final@ |
1.sex# | 2.sex# | 2.sex# | 2.sex# | 2.sex# | 2.sex# | 2.sex# | 2.sex# |
65.age5 | 0.age5 | 30.age5 | 35.age5 | 40.age5 | 45.age5 | 50.age5 | 55.age5 |
y1 158.16949 | 136.85968 | 138.76374 | 145.78036 | 147.0154 | 157.00432 | 159.36418 | 154.39765 |
c.sbp_final@ | c.sbp_final@ | ||||||
2.sex# | 2.sex# | ||||||
60.age5 | 65.age5 | ||||||
y1 158.93856 | 158.89217 |
I’ve tried it many different ways but to no avail. What I would really like is a matrix with the one variable containing the strata specification and one variable containing the means. If anyone could help me figure out how to code this I would greatly appreciate it!
0 Response to Extracting matrix rownames for svy mean with multiple groups
Post a Comment