Whenever you perform logistic regression in R, the output of your regression model will be displayed in the following format:
Coefficients:
Estimate Std. Error z value Pr(>|z|)
(Intercept) -17.638452 9.165482 -1.924 0.0543 .
disp -0.004153 0.006621 -0.627 0.5305
drat 4.879396 2.268115 2.151 0.0315 *
The Pr(>|z|) column represents the p-value associated with the value in the z value column.
If the p-value is less than a certain significance level (e.g. α = .05) then this indicates that the predictor variable has a statistically significant relationship with the response variable in the model.
The following example shows how to interpret values in the Pr(>|z|) column for a logistic regression model in practice.
Example: How to Interpret Pr(>|z|) Values
The following code shows how to fit a logistic regression model in R using the built-in mtcars dataset:
#fit logistic regression model
model #view model summary
summary(model)
Call:
glm(formula = am ~ disp + drat, family = binomial, data = mtcars)
Deviance Residuals:
Min 1Q Median 3Q Max
-1.5773 -0.2273 -0.1155 0.5196 1.8957
Coefficients:
Estimate Std. Error z value Pr(>|z|)
(Intercept) -17.638452 9.165482 -1.924 0.0543 .
disp -0.004153 0.006621 -0.627 0.5305
drat 4.879396 2.268115 2.151 0.0315 *
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
(Dispersion parameter for binomial family taken to be 1)
Null deviance: 43.230 on 31 degrees of freedom
Residual deviance: 21.268 on 29 degrees of freedom
AIC: 27.268
Number of Fisher Scoring iterations: 6
Here’s how to interpret the values in the Pr(>|z|) column:
- The p-value for the predictor variable “disp” is .5305. Since this value is not less than .05, it does not have a statistically significant relationship with the response variable in the model.
- The p-value for the predictor variable “drat” is .0315. Since this value is less than .05, it has a statistically significant relationship with the response variable in the model.
The significance codes under the coefficient table tell us that a single asterisk (*) next to the p-value of .0315 means the p-value is statistically significant at α = .05.
How is Pr(>|z|) Calculated?
Here’s how the value for Pr(>|z|) is actually calculated:
Step 1: Calculate the z value
First, we calculate the z value using the following formula:
- z value = Estimate / Std. Error
For example, here’s how to calculate the z value for the predictor variable “drat”:
#calculate z-value 4.879396 / 2.268115 [1] 2.151
Step 2: Calculate the p-value
Next, we calculate the two-tailed p-value. This represents the probability that the absolute value of the normal distribution is greater than 2.151 or less than -2.151.
We can use the following formula in R to calculate this value:
- p-value = 2 * (1-pnorm(z value))
For example, here’s how to calculate the two-tailed p-value for a z-value of 2.151:
#calculate p-value
2*(1-pnorm(2.151))
[1] 0.0314762
Notice that this p-value matches the p-value in the regression output from above.
Additional Resources
The following tutorials explain how to fit various regression models in R:
How to Perform Logistic Regression in R
How to Perform Simple Linear Regression in R
How to Perform Multiple Linear Regression in R