# R - How are the significance codes determined when summarizing a logistic regression model?

I'm doing research into understand the influential factors within a logistic regression model I've built in R using the glm() function.

From my research, it seems that using the summary() function to summarize the model is a popular method to identify which variables are significant. What I can't seem to find however is a description of what the summary function is doing to determine the significance codes (eg. the *) for each variable. This answer states that the significance codes are simply categorizations of the p-value, but I don't really understand that.

Is there anyone out there that could maybe help me understand how R computes this?

Firstly, the z or t value (depending on what family you run) is the coefficient divided by the standard error. The p value is then derived from the normal or t distributions using this z or t value.

The stars don't really add much in my view. You will see underneath the table of coefficients that there is a line which starts 'Signif. codes'. This gives the key. So a coefficient marked *** is one whose p value < 0.001. One whose coefficient is marked ** is p < 0.01. And so on.

For example (taken from https://stats.idre.ucla.edu/r/dae/logit-regression/):

mydata <- read.csv("https://stats.idre.ucla.edu/stat/data/binary.csv")
mydata$rank <- factor(mydata$rank)
mylogit <- glm(admit ~ gre + gpa + rank, data = mydata, family = "binomial")
summary(mylogit)


Gives the following output:

Call:
glm(formula = admit ~ gre + gpa + rank, family = "binomial",
data = mydata)

Deviance Residuals:
Min       1Q   Median       3Q      Max
-1.6268  -0.8662  -0.6388   1.1490   2.0790

Coefficients:
Estimate Std. Error z value Pr(>|z|)
(Intercept) -3.989979   1.139951  -3.500 0.000465 ***
gre          0.002264   0.001094   2.070 0.038465 *
gpa          0.804038   0.331819   2.423 0.015388 *
rank2       -0.675443   0.316490  -2.134 0.032829 *
rank3       -1.340204   0.345306  -3.881 0.000104 ***
rank4       -1.551464   0.417832  -3.713 0.000205 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

(Dispersion parameter for binomial family taken to be 1)

Null deviance: 499.98  on 399  degrees of freedom
Residual deviance: 458.52  on 394  degrees of freedom
AIC: 470.52

Number of Fisher Scoring iterations: 4


You can see that gre has a p value = 0.038. This has one asterisk by it because that is < 0.05. rank4 has a p value = 0.0002 and so has three asterisks because this is < 0.001.

I just use the asterisks to quickly scan the table but I never look at them beyond that.

• Ok, that makes a bit more sense to me. I thought that maybe they were calculated some other complicated way. But it seems fairly straight forward. Thanks a lot! – Eoin Aug 30 '16 at 21:08
• @Eoin you're welcome. If you feel I've answered the question, please consider accepting the answer. – Matthew Aug 31 '16 at 6:51

If you want to know right away which variables (independent variables, IVs) impacts your dependent varibale (DV) the most, you could use the following:

install.packages("caret") # run install only if you've never installed it before
library(caret)
fit<-lm(DV~IV1+IV2+IV3, data=mydata)
varImp(fit, scale = FALSE)

overall
IV1     -4.3
IV2     7.65
IV3     12.37


The IV with the highest value has the most impact. Make sure you don't use 2 IVs with a high correlation between themselves to avoid multicollinearity.

• This is helpful, but doesn't answer the question: How is the p-value calculated? – Mark White Jun 22 '17 at 13:24