# NMath User's Guide

43.1 Regression Calculators (.NET, C#, CSharp, VB, Visual Basic, F#)

Class LogisticRegression is templatized on the calculator to use to calculate the parameters of the logistic regression model. Two implementations are provided:

computes the parameters to maximize the log likelihood function for the model using the Newton Raphson algorithm to compute the zeros of the first order partial derivatives of the log likelihood function. This algorithm is equivalent to, and sometimes referred to, as iteratively reweighted least squares. Each iteration involves solving a linear system of the form X'WX = b, where X is the regression matrix, X' is its transpose, and W is a diagonal matrix of weights.

The matrix X'WX will be singular if the matrix X does not have full rank. NewtonRaphsonParameterCalc has property FailIfNotFullRank which, if true, fails in this case. If FailIfNotFullRank is false, the linear system is solved using a pseudo-inverse, and the calculation will not fail.

computes the parameters to maximize the log likelihood function for the model, using a trust region optimization algorithm to compute the zeros of the first order partial derivative of the log likelihood function. This approach is more robust than Newton Raphson with design matrices of less than full rank.

The minimization is performed by an instance of TrustRegionMinimizer, and TrustRegionParameterCalc instances may be constructed with a given minimizer with the desired algorithm properties.

Top

Top