Maximum Likelihood Estimators for Binary Outcomes

Often regressions involve binary outcome data: the object is to predict some event that will or will not occur based on various data. This Demonstration shows how to derive the maximum likelihood estimates of the coefficients in probit and logit regressions that are typically used to model data with a binary outcome. You can specify a dataset for examination, make guesses as to the and parameters, and choose a logit or probit regression model. The top panel shows the data, the current regression model (orange line) and the probability (likelihood) that each -value would occur for a given -value, given and . The bottom panel shows the sum of the log of each of these likelihoods. Selection of maximum likelihood estimates of and will make this sum as large as possible and the displayed rectangle as small as possible. You can specify the minimum displayed value of the sum of the log likelihoods. If you are curious, you can also request a computation of the correct answer for each dataset, which may be done either directly or using an iterative weighted least squares (WLS) process.


  • [Snapshot]
  • [Snapshot]
  • [Snapshot]


The Demonstration employs two alternative methodologies to compute the maximum likelihood estimators: The first method uses global optimization routines to find the values of and that maximize the sum of the logs of the likelihoods of each data point. The second method uses an iterative weighted least squares process which makes assumptions about weights, figures out what coefficients minimize the residuals, figures out what weights are consistent with the resulting model, and so on until convergence is reached. Consistent with predictions, the results of the two methodologies appear to be the same in all cases. On larger datasets, the weighted least squares method is expected to be faster owing in part to the intricacies of global optimization.
The optimization code used here can be readily extended to address more complex models.
The controls of this Demonstration will generally respond more swiftly if "compute MLE" is unchecked.
    • Share:

Embed Interactive Demonstration New!

Just copy and paste this snippet of JavaScript code into your website or blog to put the live Demonstration on your site. More details »

Files require Wolfram CDF Player or Mathematica.

Mathematica »
The #1 tool for creating Demonstrations
and anything technical.
Wolfram|Alpha »
Explore anything with the first
computational knowledge engine.
MathWorld »
The web's most extensive
mathematics resource.
Course Assistant Apps »
An app for every course—
right in the palm of your hand.
Wolfram Blog »
Read our views on math,
science, and technology.
Computable Document Format »
The format that makes Demonstrations
(and any information) easy to share and
interact with.
STEM Initiative »
Programs & resources for
educators, schools & students.
Computerbasedmath.org »
Join the initiative for modernizing
math education.
Step-by-Step Solutions »
Walk through homework problems one step at a time, with hints to help along the way.
Wolfram Problem Generator »
Unlimited random practice problems and answers with built-in step-by-step solutions. Practice online or make a printable study sheet.
Wolfram Language »
Knowledge-based programming for everyone.
Powered by Wolfram Mathematica © 2018 Wolfram Demonstrations Project & Contributors  |  Terms of Use  |  Privacy Policy  |  RSS Give us your feedback
Note: To run this Demonstration you need Mathematica 7+ or the free Mathematica Player 7EX
Download or upgrade to Mathematica Player 7EX
I already have Mathematica Player or Mathematica 7+