Once we have a model (the logistic regression model) we need to fit it to a set of data in order to estimate the parameters β0 and β1.
In a linear regression we mentioned that the straight line fitting the data can be obtained by minimizing the distance between each dot of a plot and the regression line. In fact we minimize the sum of the squares of the distance between dots and the regression line (squared in order to avoid negative differences). This is called the least sum of square method. We identify b0 and b which minimise the sum of squares.
In logistic regression the method is more complicated. It is called the maximum likelihood method. Maximum likelihood will provide values of β0 and β1 which maximise the probability of obtaining the data set. It requires iterative computing and is easily done with most computer software.
We use the likelihood function to estimate the probability of observing the data, given the unknown parameters (β0 and βb1). A "likelihood" is a probability, specifically the probability that the observed values of the dependent variable may be predicted from the observed values of the independent variables. Like any probability, the likelihood varies from 0 to 1.
Practically, it is easier to work with the logarithm of the likelihood function. This function is known as the log-likelihood, and will be used for inference testing when comparing several models. The log likelihood varies from 0 to minus infinity (it is negative because the natural log of any number less than 1 is negative).
The log likelihood is defined as:
parameters β0 and β1 is done using the first
derivatives of log-likelihood
(these are called the likelihood equations), and solving them for β0
and β1. Iterative computing is used. An arbitrary
value for the coefficients (usually 0) is first chosen. Then
computed and variation of coefficients values observed. Reiteration is
performed until maximisation (plateau). The results are the maximum
likelihood estimates of β0 and β1.
that we have estimates for β0 and β1, the next step is inference testing.
responds to the question: "Does the model including
a given independent variable provide more information about occurrence
disease than the model without this variable?" The response is
obtained by comparing the observed values of the dependent variable to
predicted by two models, one with the independent variable of interest
without. If the predicted values of the model with the independent
better then this variable significantly contributes to the outcome. To
do so we
will use a statistical test.
Three tests are
The Likelihood ratio statistic (LRS) can be
directly computed from likelihood functions of both models.
are always less than one, so log likelihoods are always negative; we
with negative log likelihoods for convenience.
likelihood ratio statistic (LRS) is a test of the
significance of the difference (the ratio if expressed in log) between
likelihood for the researcher's model minus the likelihood for a reduced
(the models with and without a given variable).
LRS can be
used to test the significance of a full model (several independent
the model versus no variable = only the constant). In that situation it
the probability (the null hypothesis) that all β are equal
to 0 (all slopes corresponding to each variable are equal to 0). This
that none of the independents variables are linearly related to the
odds of the dependent variable.
LRS does not
tell us if a particular independent variable is more important than
This can be done, however, by comparing the likelihood of the overall
with a reduced model which drops one of the independent variables.
that case the LRS
tests if the logistic regression coefficient for the dropped variable
If so it would justify dropping the variable from the model. A non
significant LRS indicates
no difference between the full and the reduced models.
be computed from deviances.
In which D- and D+
respectively the deviances of the models without and with the variable
The deviance can be
computed as follows:
(A saturated model
being a model in which there are as many parameters as data points.)
Under the hypothesis
that β1= 0, LRS follows a
chi-square distribution with 1 degree of freedom. The derived p-value can be
The following table
illustrates the result of the analysis (using a logistic regression
a study assessing risk factors for myocardial infarction. The LRS
(p < 0,001) suggesting that oral contraceptive (OC) use is a
predictor of the outcome.
Table 1: Risk factors for myocardial infarction. Logistic regression model including a single independent variable (OC)
of valid Observations
In model 2, model 1
was expended and another variable was added (the age in years). Here
addition of the second variable contributes significantly to the model.
(LRS = 16,7253, p < 0,001) expresses the difference in likelihood
the two models.
Table 2: Risk factors for myocardial infarction. Logistic regression model including two independent variable (OC and AGE)
<<Back to Logistic regression