Although statistical software has long been used for maximum likelihood (ML) estimation, the focus of attention has almost always been on obtaining ML estimates (a numerical problem), rather than on deriving ML estimators (a symbolic problem; cf. Rose and Smith, 2000). mathStatica makes it possible to derive exact symbolic ML estimators from first principles with a computer algebra system.
For instance, consider the following simple problem: let denote a random sample of size n collected on where parameter is unknown. We wish to find the ML estimator of σ. We begin in the usual way by inputting the likelihood function into Mathematica:
If we try to evaluate the log-likelihood:
... nothing happens! (Mathematica assumes nothing about the symbols that have been entered, so its inaction is perfectly reasonable.) But we can enhance Log to do what is wanted here using the mathStatica function SuperLog. To activate this enhancement, we switch it on:
If we now evaluate Log[L] again, we obtain a much more useful result:
To derive the first-order conditions for a maximum:
... we solve FOC==0 using Mathematica’s Solve function. The ML estimator is given as a replacement rule -> for σ:
The second-order conditions (evaluated at the first-order conditions) are always negative, which confirms that is indeed the ML estimator:
Finally, let us suppose that an observed random sample is :
Then the ML estimate of σ is obtained by substituting this data into the ML estimator :
Figure 1 plots the observed likelihood (for the given data) against values of σ, noting the derived exact optimal solution .
Fig. 1: The observed likelihood and