Insert the name of the x-variable(s) that you want to use.
More information help logistic
Note The logistic command automatically produces odds ratios. If you, for some reason, want to produce log odds instead, try logit.
A walk-through of the output
When we perform a logistic regression in Stata, the table looks like this:
In this example, yvar is a binary (0/1) variable, whereas xvar1 is a binary (0/1) variable and xvar2 is a variable ranging between 0 and 10.
The upper part of the table shows a model summary. This is what the different rows mean:
Log likelihood
This value does not mean anything in itself, but can be used if we would like compare nested models.
Number of obs
The number of observations included in the model.
LR chi2(x)
The likelihood ratio (LR) chi-square test. The number within the brackets shows the degrees of freedom (one per variable).
Prob >chi2
Shows the probability of obtaining the chi-square statistic given that there is no statistical effect of the x-variables on y. If the p-value is below 0.05, we can conclude that the overall model is statistically significant.
Pseudo R2
A type of R-squared value. Seldom used.
The lower part of the table presents the parameter estimates from the analysis.
The first column lists the y-variable on top, followed by our x-variable(s). The last row represents the constant (intercept).
Odds ratio
These are the odds ratios.
Std. Err.
The standard errors associated with the coefficient.
Z
Z-value (coefficient divided by the standard error of the coefficient).
P>|z|
P-value.
[95% Conf. Interval]
95% confidence intervals (lower limit and upper limit).
The analytical sample used for the examples
In the subsequent sections, we will use the following variables:
Dataset
StataData1.dta
Variable name
earlyret
Variable label
Early retirement (Age 50, Year 2020)
Value labels
0=No 1=Yes
Variable name
bmi
Variable label
N/A
Value labels
N/A
Variable name
sex
Variable label
Sex
Value labels
0=Man 1=Woman
Variable name
educ
Variable label
Educational level (Age 40, Year 2010)
Value labels
1=Compulsory 2=Upper secondary 3=University
sum earlyret bmi sex educ
We define our analytical sample through the following command:
gen pop_logistic=1 if earlyret!=. & bmi!=. & sex!=. & educ!=.
This means that new the variable pop_logistic gets the value 1 if the four variables do not have missing information. In this case, we have 7,406 individuals that are included in our analytical sample.