Generalized Linear Model (GLM) Fitting Algorithm