4 The EF likelihood and ML estimation

4.1 A Poisson example

Consider the AIDS data presented in Chapter 1. To write down the likelihood function we need to specify the pmf under the assumption of independent observations. We wish to fit the model:

Yi|tiPois(μi),fori=1,2,,nwithlog(μi)=a+bti,

where yi is the number of observed deaths in the quarter ti. We denote the pmf by fi(yi|μi) of a single observation yi. Here μ is a parametric function rather than a parameter itself. Furthermore, as the value of μ can change between observations due to the linear relation to the time covariate, so we do not assume that the observations are identically distributed.

 aids = read.table("aids.dat")
 attach(aids)
 plot(time, number)
 a = 0.340 ; b = 0.257 ; mu = exp(a + b * time)
 lines(time, mu)

This plot is presented in Section 1.3.2. The free parameters that determine the mean here are a and b.

Free parameters

There are several ways to specify which parameters are free and which are constrained. The moment parameter μ is always in one-to-one correspondence with the canonical parameter, e.g. θ=log(μ). We may write the likelihood in terms of μ or in terms of θ as f(y|μ)=f(y|θ).

Baseline models

Taking the n values of μ, μi, i=1,2,,n, to be free leads to the saturated model with n free parameters. It is of theoretical interest as a baseline model. However, as it does not simplify the data, it is not usually a model to fit in its own right; n unknowns for n observations!

Setting the n values μi, i=1,2,,n, to be equal gives a model with just 1 free parameter, the null model.

Parsimony suggests a model with greater than 1 but less than n free parameters. Here, constraining the moment parameters by log(μi)=a+bti, where β=(a,b) leads to a model with two free parameters.

 
Exercise 4.37
The contribution to the likelihood of the ith observation, yi, drawn from the Poisson distribution is one of the following:

(1)(Y=y|μ)=μyexp{-μ}1y!,(2)(Y=yi|μ)=μyiexp{-μ}1yi!,(3)(Yi=yi|μi)=μiyiexp{-μi}1yi!.

Which?

 

Model formula

With β=(a,b) the log-likelihood of β given observations y1,y2,,yn is:

(β) = i=1n{yilogμi-μi-log(yi!)}
= i=1n{yi(a+bti)-exp{a+bti}-log(yi!)}.

This is a function on β2.

Notation

We can consider this log-likelihood as a function of the vector of means 𝝁=(μ1,μ,,μn), and write

(𝝁) = i=1n{yilogμi-μi-log(yi!)}

where the means are constrained by

log(𝝁)={log(𝝁)=a𝟏+b𝐭,(a,b)2},

spanned by the n-dimensional vectors 𝟏 and 𝐭. Recall that g=log is the link function for the Poisson distribution.

This notation allows the log-likelihoods for each model to be simply expressed as

(𝝁) constrained by .

Here the null model is ={log(𝝁)=a𝟏,a1}. The saturated model is ={log(𝝁)n}. And a 3-dimensional model is ={log(𝝁)=a𝟏+b𝐭+clog(𝐭)}.

ML estimates

The partial derivative of the log-likelihood for each free parameter a and b are:

(a,b)a=i=1n(yi-exp{a+bti})(a,b)b=i=1n(yiti-tiexp{a+bti})

Except in special cases, it is not possible to analytically solve the above equations to determine the maximum likelihood estimates a^ and b^. We therefore need to use a numerical technique to find the maximum likelihood estimate of the parameters. We shall examine this numerical technique in the next chapter. In the meantime, we can use this algorithm in R via the glm() command.

The necessary arguments for the glm() command are:

formula

A symbolic description of the model to be fitted. E.g. number ~ 1 + time.

family

A description of the error distribution and link function to be used in the model. E.g. poisson(link="log")

data

A data frame containing the variables of the model. E.g. aids.

We can estimate the free parameters by:

 AIDSModel <- glm(number~1+time, family=poisson(link="log"), data=aids)
 AIDSModel

This will return

Call:  glm(formula = number ~ 1 + time, family = poisson(link = "log"),
    data = aids)

Coefficients:
(Intercept)         time
     0.3396       0.2565

Degrees of Freedom: 13 Total (i.e. Null);  12 Residual
Null Deviance:      207.3
Residual Deviance: 29.65        AIC: 86.58

The ML estimates a^=0.340 and b^=0.257 maximise the Poisson regression model ={log(𝝁)=a𝟏+b𝐭}.