Logistic Regression Demo in Excel

Category:
Office/VBA
Type:
Snippets
Difficulty:
Intermediate
Author:
Anonymous

Version Compatibility: Visual Basic 6

More information:
The workbook contains VBA code for implementing the Iteratively Reweighted Least Squares approach to maximum likelihood estimation for binary logistic regression. The code is meant to illustrate the algorithm and not for implementation on larger problems. The construction of the nxn matrix D can be eliminated since only the diagonal is required. Similarly, the majority of the matrix algebra implemented in the routine can be bypassed. There is no half-stepping or ridging implemented in the routine, but half-stepping is effective and simple to implement (just halve the coefficient adjustment until the likelihood function decreases). The code does not test for quasi- or complete-separation. However, by checking the hats one can implement an effective test. If optimized, a VBA implementation can be rather quick. I have a version that can compute the usual output including the log likelihood test, pearson & deviance tests, measures of association, and the Hosmer-Lemeshow test for 20 variables and 40K cases in less than 10 seconds.

Instructions: Click the link below to download the code. Select 'Save' from the IE popup dialog. Once downloaded, open the .zip file from your local drive using WinZip or a comparable program to view the contents.

Download fisherscoring.zip