The deviance \(\chi^2\) value is,
where \(g\) is the number of replicate groups in the design, \(n_i\) is the number of runs, \(y_i\) is the number of successes (1s), and \(\hat{\pi}_i\) is the predicted probability in the \(i^{th}\) replicate group.
The degrees of freedom for the test is the number of replicate groups minus the number of parameters \(p\) in the model, \(df = g - p\).
There is evidence of poor fit if the \(\chi^2\) value per degree of freedom, \(D/df = D/(g-p)\), differs significantly from 1 or the p-value is less than the \(\alpha\)-risk.
If the design contains few replicates use the Hosmer-Lemeshow test instead.
References
Douglas C. Montgomery, Peck, Elizabeth A., and G. Geoffrey Vining. Introduction to Linear Regression Analysis. Wiley, 5th edition, 2012.