# Hosmer-Lemeshow Goodness-of-Fit Test

The Hosmer-Lemeshow test is a statistical test for goodness of fit for the logistic regression model. The data is divided into a number of groups (ten groups is a good way to start). The observed and expected number of cases in each group is calculated and a Chi-squared statistic is calculated as follows:

where **O**g signifies the observed events, **E**g signifies the expected events and **n**g signifies the number of observations for the **g**th group, and **G** is the number of groups. The test statistic follows a Chi-squared distribution with (G-2) degrees of freedom.

### Application and Interpretation:

A large value of Chi-squared (with small p-value < 0.05) indicates poor fit and small Chi-squared values (with larger p-value closer to 1) indicate a good logistic regression model fit.

### Input and Output:

To run Hosmer-Lemeshow Goodness of Fit function, you can login to **Analyttica TreasureHunt**** **and** **should select the target binary variable and the independent variables in which will be used to build a logistic regression model and perform Hosmer-Lemeshow Goodness of Fit test.

### See Also:

Log Odds Ratio, Odds Ratio, Logistic Regression, Kolmogorov Smirnov Diagnostics.