6.6 Finding the Best Fit Curve
Now, the question arises: How can we determine the optimal likelihood of observing a specific outcome?
To explore this, let's go back to our previous chapter on Linear regression and look at the methods used there. Can we use the same approach in Logistic regression? If yes, how? And if not, what's the equivalent method?
In Linear regression, we utilised the Ordinary Least Square (OLS) method, which calculates the optimal values of beta coefficients to minimise the Sum of Squared Errors (SSE) and obtain the best fit line. However, upon closer examination, we realise that the OLS technique is not suitable for Logistic regression. There are a few reasons for this. Firstly, OLS is designed for continuous and normally distributed dependent variables, whereas Logistic regression deals with discrete or categorical outcomes that do not possess these characteristics. Secondly, there is no notion of “error” in the context of probability. Moreover, incorporating probabilities directly into the OLS approach would violate the assumptions of the method, as the predicted values would not fall within the appropriate range.
So, instead of Ordinary least-squares (OLS), we employ a technique known as Maximum likelihood to determine the best fit curve in logistic regression.
In Maximum Likelihood Estimation, we begin by assuming a probability distribution for the dependent variable and then define a likelihood function (as discussed in section 6.5). The goal is to optimise the likelihood function to determine the set of beta coefficients that maximises the overall likelihood across the dataset.
Typically, to find the maximum likelihood estimates we’d take the log of likelihood and differentiate the log-likelihood with respect to the parameters, set the derivatives equal to zero, and solve. However, in this case, we will not be able to set this to zero and solve, as there is no closed-form solution ( mathematical expression or formula that provides an exact solution to the equation). There are several methods (Bisection method, Fixed-point iteration, Newton-Raphson method, Muller's method) available which can be employed to determine the beta coefficients that maximise the likelihood function, however, it is beyond the scope of this book. Fortunately, most practitioners do not need to delve into the intricacies of these methods, as there are programming…