Maximum Likelihood Estimators with Normally Distributed Error

In statistics, there is a frequent desire to develop a model that has, of all models in that class, the maximum likelihood of producing the data observed. This Demonstration shows how to derive the maximum likelihood estimates of the coefficients in a linear model of data () that is believed to have normally distributed error with a standard deviation of a user-set value . The top panel shows the data, the current regression model (as an 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 logs 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. Curious users can request a computation of the maximum likelihood estimate for each dataset.


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


For pedagogical purposes, this Demonstration finds maximum likelihood estimators using a general approach. In specific cases, more efficient and swifter computational methods may exist. In particular, optimal parameter values in the case of normally distributed error can be obtained via linear least-squares optimization; the maximum likelihood estimate of the standard deviation can be obtained as the square root of the mean of the squared residuals. The code underlying this Demonstration permits this swifter but less general methodology to be used.
This Demonstration will be more responsive to movements of the parameter sliders if no computation of the maximum likelihood estimate is requested.
A useful experiment is to set the parameter sliders so that they correspond to the optimal parameter values determined by the computer. Then determine the effect on the sum of the log likelihoods as the σ parameter increases. Then see what happens if you set the α and β parameter sliders to suboptimal levels. Does increasing increase or decrease the sum of the log likelihoods?
    • 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+