[Stata] Post-estimation commands for regression models: listcoef
In this blog post, I will show you how to use listcoef
command in stata for logistic regression. listcoef
displays the coefficients of a logistic regression model in different metrics, such as odds ratios, and standardized coefficients.
I will use the nhanes2 dataset, which contains data from the second National Health and Nutrition Examination Survey conducted in the United States from 1976 to 1980. The dataset has 10,351 observations and 15 variables, including demographic, health, and nutrition information. You can load the dataset in stata by typing:
webuse nhanes2
I will use the variable highbp as the outcome variable, which indicates whether the respondent has high blood pressure (1=yes, 0=no). I will use the following explanatory variables: age (in years), sex (1=male, 0=female), race (1=white, 2=black, 3=other), and bmi (body mass index). I will fit a logistic regression model using the logit command:
logit highbp age i.sex i.race bmi
The output of the logit command will show the coefficients of the model in the log-odds scale, along with the standard errors, z-statistics, and p-values. The output also shows the model fit statistics, such as the log-likelihood, the pseudo R-squared, and the likelihood-ratio test.
listcoef
command: Getting coefficients and odds ratio
To display the coefficients of the model in different metrics, I will use the listcoef command. This command has several options, such as std, help. The std option shows the standardized coefficients, which are the coefficients obtained by standardizing both the outcome and the explanatory variables. The help
option shows the interpretation of the coefficients in plain language. Here is an example of using the listcoef command with these options:
ssc install listcoef
listcoef, percent help
listcoef, std help
The output of the listcoef command shows the coefficients in four columns: b, sd(b), e(b), and se(eb). The b column shows the log-odds coefficients, the sd(b) column shows the standardized coefficients, the e(b) column shows the odds-ratio coefficients, and the se(eb) column shows the standard errors of the odds-ratio coefficients. The output also shows the interpretation of the coefficients for each variable.
You can also interpret coefficients by using listcoef command. By using std option, you can get fully standardized estimates (bStdXY
) to see which variable has the largest impact.
listcoef, std help
Here, age has the largest impact on the probability of having high blood pressure.
Reference
Annotated Stata Outputfor Listcoef Command (ucla.edu)
Beyond Binary: Multinomial Logistic Regression in Stata (ucla.edu)