webuse nhanes2l, clear
(Second National Health and Nutrition Examination Survey)
describe bpsystol agegrp
Variable Storage Display Value
name type format label Variable label
--------------------------------------------------------------------------------
bpsystol int %9.0g Systolic blood pressure
agegrp byte %8.0g agegrp Age group
summarize bpsystol agegrp
Variable | Obs Mean Std. dev. Min Max
-------------+---------------------------------------------------------
bpsystol | 10,351 130.8817 23.33265 65 300
agegrp | 10,351 3.35813 1.735657 1 6
label list agegrp
agegrp:
1 20–29
2 30–39
3 40–49
4 50–59
5 60–69
6 70+
regress bpsystol i.agegrp
Source | SS df MS Number of obs = 10,351
-------------+---------------------------------- F(5, 10345) = 606.28
Model | 1276952.17 5 255390.434 Prob > F = 0.0000
Residual | 4357717.85 10,345 421.239039 R-squared = 0.2266
-------------+---------------------------------- Adj R-squared = 0.2263
Total | 5634670.03 10,350 544.412563 Root MSE = 20.524
------------------------------------------------------------------------------
bpsystol | Coefficient Std. err. t P>|t| [95% conf. interval]
-------------+----------------------------------------------------------------
agegrp |
30–39 | 2.89081 .6642831 4.35 0.000 1.588686 4.192933
40–49 | 9.597631 .7160526 13.40 0.000 8.194029 11.00123
50–59 | 18.32889 .7126412 25.72 0.000 16.93198 19.72581
60–69 | 24.17618 .5734587 42.16 0.000 23.05209 25.30027
70+ | 30.82992 .7802491 39.51 0.000 29.30048 32.35936
|
_cons | 117.3466 .4261086 275.39 0.000 116.5113 118.1818
------------------------------------------------------------------------------
testparm i.agegrp
( 1) 2.agegrp = 0
( 2) 3.agegrp = 0
( 3) 4.agegrp = 0
( 4) 5.agegrp = 0
( 5) 6.agegrp = 0
F( 5, 10345) = 606.28
Prob > F = 0.0000
test 2.agegrp = 6.agegrp
( 1) 2.agegrp - 6.agegrp = 0
F( 1, 10345) = 1136.36
Prob > F = 0.0000
margins agegrp
Adjusted predictions Number of obs = 10,351
Model VCE: OLS
Expression: Linear prediction, predict()
------------------------------------------------------------------------------
| Delta-method
| Margin std. err. t P>|t| [95% conf. interval]
-------------+----------------------------------------------------------------
agegrp |
20–29 | 117.3466 .4261086 275.39 0.000 116.5113 118.1818
30–39 | 120.2374 .5096111 235.94 0.000 119.2384 121.2363
40–49 | 126.9442 .5754674 220.59 0.000 125.8162 128.0722
50–59 | 135.6754 .5712171 237.52 0.000 134.5557 136.7951
60–69 | 141.5227 .3837791 368.76 0.000 140.7704 142.275
70+ | 148.1765 .6536208 226.70 0.000 146.8952 149.4577
------------------------------------------------------------------------------
marginsplot, xdimension (agegrp)
Variables that uniquely identify margins: agegrp
marginsplot, xdimension (agegrp) recast (bar)
Variables that uniquely identify margins: agegrp
marginsplot, xdimension (agegrp) recast (bar) plotopts (barwidth(.9))
>
Variables that uniquely identify margins: agegrp
marginsplot, xdimension (agegrp) horizontal recast (bar) plotopts (barwidth(.9))
Variables that uniquely identify margins: agegrp
marginsplot, xdimension (agegrp) horizontal recast (scatter)
Variables that uniquely identify margins: agegrp
marginsplot, xdimension (agegrp) horizontal recast (scatter) plotregion(margin(large))
Variables that uniquely identify margins: agegrp
webuse nhanes2l, clear
(Second National Health and Nutrition Examination Survey)
describe bpsystol bmi
Variable Storage Display Value
name type format label Variable label
--------------------------------------------------------------------------------
bpsystol int %9.0g Systolic blood pressure
bmi float %9.0g Body mass index (BMI)
summarize bpsystol bmi
Variable | Obs Mean Std. dev. Min Max
-------------+---------------------------------------------------------
bpsystol | 10,351 130.8817 23.33265 65 300
bmi | 10,351 25.5376 4.914969 12.3856 61.1297