You are on page 1of 16
Bate ra bo0 General Interest Section Maximum Likelihood Estimation and Mathematica By AWN 0. CURRIES Hero Us, Eaugh UE ois 1. Introduction We show how several maximum likelihood problems can be solved by computer algebra. We use Mathematica (Wolfram, 1981) but almost any computa. algsia program would suffice. Mathematica isan attractive tool for maximiam Lkelihood fstimation since a wide range of problems can be tackled with a common method: ‘of the paper gives examples that show how Mathematica is used for jon. Section 2 uses two elementary problems (one discrete and one continuous) to establish the basic approach that is wed with Mathematics. Section ‘applies the method to problems involving censoring, tuncating and grosping: an example is taken from Yule and Kendall 1968) co illustcate estimation wit grouped ‘normal data, whereas an example discussed by Brass (1958) is used to demonstrate the method for the truncated negative binomial distribution. Section 4 stows how seneralized linear models can be fitted, our examples here being a binary regression ‘with logit link and an analysis of a dilation assay; the data come from Bliss (1935) and Wetherill (1981) respectively. Section 5 looks at two research problams. The First shows how Mathematica is used to del witha gamma model with incomplete data and presents a problem used by Meng and Rubin (1993); the second is @ {Adin fo corpondee Depa of Acai Mathai ad Sint, Heo Was Ue, eT oe x0 connie ‘quadratic logistic model diseussed by Dellaportas and Smith (1993). Some conclu- ‘Sons ate given in Section6. 2, Simple Examples In this section we consider two elementary examples. The first stows how to deal with a discrete distribution (Poisson) whereas the second uses continuous ‘istibution (normal). We begin with estimation for the Poisson distritution. Table 1 pives the Bortkewisch (1898) data on deaths from the kick of a horse in 10 Prussian Army corps over the 20-year period 1875-94. As is usual for data ofthis Sor, the 200 observations are presented in a frequency table ‘Mathematica consists of @ core program, known asthe kernel, ané many more specialized functions organized in packages. We begin by loading two of the Statistical packages with Gott" SteiaticeDisrateDisibuons") Get" Stetice ContinoousDistbuti ‘To obtain the likelihood forthe Poisson model for these data in Mathematica we proceed as follows. Fst, we use the discrete distributions package ard obtain the probability distribution with ‘rob = Table POF[PolasonDistibution(t) ). ft 0, 4}] o Alternatively, we could supply the probability function diretly with prob = Table Ett (r.0, 4)1 ® In this paper we use the statistical packages, but, whichever method is used, ‘Mathematia responds with ist of the Paiseon prabahities in famine algerie oom: 28 et ‘E2e or we Mathematica numbers is input and output statements; Outs refers 16 the output from the fourth input line. Second, we Supply the date with (109, 65, 22. 9,1} “The output from lel = Apel Pus, tea Loateb ° ives the lop-likelinood in algebraic form owes =[ tre ‘Proquney of death rom the Bk of «horse wane i ae eked ‘out{a] and Ovo] are examples of the symbolic output that characterizes Mathes matin (and programs like). The two examples give an indication of the kind of ‘pression thar Mathematica produces, From now on, we generally omit these ‘One ofthe attractions ofa program like Mathematica i the ease with which plots can be produced. The command Plttiog! {8 6H) © produces a plot of logl where the plot parameters» and b determine the range of the plot. A litle experimentation with a and b will give «satisfactory plot; Fig was produced with a = 0.3 and b= 0.8, “The maximum likelihood estimate of the Poisson parameter tis obtained with maxlog = FndMinimem—tog. (8, 1}) ‘nla = maxleg [121] “The FindMinimum function uses the method of stcpest descent with derivatives computed algebraically. FndMinimar returns a list with two entries: the first lement ofthe iste the minimum value of ~togl and the second isthe maximum likelinood estimate of t. The initial value of 1 in equations (8) can be taken from Fig. I. The information function is found symbolically with Dltogl tt © fof the maximum likelihood estimate of t follows with o and the standard ex Fie 1. Lopes fr the Poison mode

You might also like