What is Null and Residual deviance in logistic regression



I am currently working on logistic regression in R and I have trained the model but when I am looking at features of model, I am not able to understand what is Null and Residual deviance explains ?


Call: glm(formula = vs ~ wt + disp, family = “binomial”, data = mtcars)

(Intercept) wt disp
1.60859 1.62635 -0.03443

Degrees of Freedom: 31 Total (i.e. Null); 29 Residual
Null Deviance: 43.86
Residual Deviance: 21.4 AIC: 27.4



Above we can see that two deviances NULL and Residual. Here Value of NULL deviance can be read as 43,86 on 31 degrees of freedom and Residual deviance as 21.4 on 29 degrees of freedom. Deviance is a measure of goodness of fit of a model. Higher numbers always indicates bad fit.

The null deviance shows how well the response variable is predicted by a model that includes only the intercept (grand mean) where as residual with inclusion of independent variables.

Above, you can see that addition of 2 (31-29 =2) independent variablesdecreased the deviance to 21.4 from 43.86, a significant reduction in deviance.The Residual Deviance has reduced by 22.46 with a loss of two degrees of freedom.

If your Null Deviance is really small, it means that the Null Model explains the data pretty well. Likewise with your Residual Deviance.



hi@steve :: what does degrees of freedom mean:)


degree of freedom implies the how many independent random variables you have.


Can anyone explain about the range for the NULL deviance and Residual deviance being good or bad.
If i have NULL deviance as 120.61 on 495 degrees of freedom.
and Residual deviance as 83 on 383 degrees of freedom.
So what can we exactly interpret with the numbers here?
Is the model good if good why and if bad why.
Please explain with the numbers mentioned above