> In some cases, y is equal to the same value (example 1) for all observations. Theoretically, the model should not converge. Nonsense. This is a very simple dataset for which the maximum likelihood results are known in closed form. Convergence (in terms of the fitted values) is quite simple. > But, when I use the glm function in R it doesn't show me an error or a warning! Of course not. Instead it has converged and given you the correct results. If all the `y=1`, then the maximum likelihood solution occurs when: - all fitted values are equal to 1 - residual deviance is 0 - intercept is positive infinity - slope is zero and that is exactly what R's glm function has given you. To working precision, the intercept value is 25.57 is large enough to be effectively infinite, because larger values would only change the fitted values in the 10th decimal place. Note that, although it is hard to measure convergence of the intercept to infinity, it is very simple to measure convergence of the fitted values to 1 and convergence of the deviance to zero. It is exactly to handle cases like this that the convergence criterion for the glm iterative algorithm is defined in terms of the fitted values rather than in terms of the coefficient estimates. The definition of the convergence criterion in terms of fitted values goes back to the earliest papers on generalized linear models nearly 50 years ago. > What do I need to change so that the glm function gives me an error instead of a result? Why would you want to stop the function from working properly and giving correct results? > another software (SAS) I get an error and the program stops! Why don't you write to SAS to report the bug? You could ask them why such as expensive piece of software as SAS can't cope with such a small simple dataset. Why can't SAS do what other software programs like GLIM, Genstat, S-Plus and R have been able to do so easily for nearly 50 years? **Answer to similar question on R-devel mailing list** A very similar question was asked on the R-devel mailing list nearly 20 years ago, when Brian Ripley and I gave the same answer as above: - https://stat.ethz.ch/pipermail/r-devel/2003-June/026812.html - https://stat.ethz.ch/pipermail/r-devel/2003-June/026816.html