reg1 template: survey weights
It is common in the epidemiology research to report odd ratios or risk-ratios and their p-values from logistic regression or other regression models. reg1
template of asdocx makes it extremely easy to build such tables with much needed flexibility. In my previous post, I showed how to use reg1 template [see post ].
In this post, I want to show you how to use the survey prefix with the reg1
template. The syntax of using the svy
prefix with asdocx is given below.
Syntax
asdocx svy: reg depvar indepvars, title(text) dec(#) dect(#) ///
template(reg1) reg_options
Syntax Details
The syntax starts with the keywords asdocx
followed by the svy:
The word reg
can be any Stata command for regressions such reg
for ols, logistic
for logistic regressions, etc.
The depvar
is the dependent or the explained variable .
The indepvars
are all other independent or explanatory variables in the regression model.
An Example
asdocx svy: logistic heartatk tcresult tgresult age race sex houssiz smsa region, template(reg1) dec(4) dect(2) replace
In the above example, heartatk is the dependent
variable and all other variables are independent
. After comma, option template(reg1)
causes asdocx to use the reg1
template. The above code generates a table that looks like this.
Variable | OR [95% CI] | P-value |
---|---|---|
Serum cholesterol (mg/dL) | 1.0001 [0.9958, 1.0045] | 0.95 |
Serum triglycerides (mg/dL) | 1.0023 [1.0007, 1.0038] | 0.00 |
Age (years) | 1.0941 [1.0826, 1.1056] | 0.00 |
Race | 0.8727 [0.5552, 1.3717] | 0.54 |
Sex | 0.4100 [0.2791, 0.6024] | 0.00 |
Number of people in household | 1.0034 [0.8641, 1.1651] | 0.96 |
SMSA type | 0.9938 [0.8426, 1.1721] | 0.94 |
Region | 1.0563 [0.8870, 1.2581] | 0.53 |
Constant | 0.0007 [0.0002, 0.0026] | 0.00 |
Observations | 5049 |
subpop() option
Subpopulation estimation focuses on part of the population. The svy
prefix command’s subpop()
option performs subpopulation estimation. If we were to estimate the above regression only for female population, we would use the subpop(if female == 1)
options. See this example:
asdocx svy, subpop(if female == 1): logistic heartatk tcresult tgresult age race sex houssiz smsa region, template(reg1) dec(4) dect(2) replace
Variable | OR [95% CI] | P-value |
---|---|---|
Serum cholesterol (mg/dL) | 0.9983 [0.9922, 1.0043] | 0.56 |
Serum triglycerides (mg/dL) | 1.0081 [1.0050, 1.0112] | 0.00 |
Age (years) | 1.0783 [1.0511, 1.1062] | 0.00 |
Race | 0.9048 [0.4112, 1.9913] | 0.80 |
o | 1.0000 [ ., .] | . |
Number of people in household | 0.9465 [0.7054, 1.2699] | 0.71 |
SMSA type | 0.8413 [0.6615, 1.0699] | 0.15 |
Region | 1.4284 [1.0825, 1.8849] | 0.01 |
Constant | 0.0001 [0.0000, 0.0009] | 0.00 |
Observations | 7523 |
Order asdocx
Yearly license of asdocx is available at $9.99. Its life-time license is available at $49.99. With the asdocx membership, you get :
- Life-time license to use
- All future updates
- All premium templates / plugins.