I.4.3.3: Loglinear Models

Let be a Poisson-log-likelihood with We see that and Thus the log-likelihood is concave. Normally we would apply a safe-guarded version of Newton's method, but here we want to illustrate CCA.

Now suppose is a design-type matrix, with elements equal to or Let Then the likelihood equations are Solving each of these in turn is CCA (since we are maximizing), which is also known in this context as the iterative propertional fitting or IPF algorithm.

We have, using for the coordinate directions, with This explains the name of the algorithm, because the in are adjusted with the same proportionality factor.

Thus the optimal is simply

This example can be extended to the case in which the elements of the design matrix are and We define and We now have to solve the quadratic equation with for the proportionality factor. If then as before. If then If the positive and negative index sets are both nonempty, then the quadratic always has one positive and one negative root, and we select the positive one.

Basically the same CCA/IPF technique can also be applied if the elements of are arbitrary integers. To avoid trivialities we assume each column of has at least one non-zero element. In that case solving for amounts to solving a higher degree polynomial equation. Suppose the non-zero elements of column of are from a set of integers. Elements of can be positive or negative. Define Also define To find the optimal for coordinate we must solve , where Note that for all , i.e. is strictly increasing. Let be the maximum of the and let be the minimum. We can distinguish three different behaviors of on the positive reals.

  1. If then increases from 0 to .
  2. If then increases from to 0.
  3. If and then increases from to .

In all three cases there is a unique positive root of the equation . To solve we note that if we need to find the unique positive real root of a polynomial of degree . If we solve the equation for , again finding the unique positive real root of a polynomial of degree . In case 3, in which has both negative and positive elements, we multiply both sides of the equation by to get which is a polynomial equation of degree , again with a single positive real root. I have written an R program for this general case. The function polyLogLinF does the computations, the function polyLogLin is the driver for the iterations.


[Insert polyLoglin.R Here](../code/polyLoglin.R)


Consider the example with

> x
      [,1] [,2] [,3] [,4]
 [1,]    1    1   -1    0
 [2,]    1    1    1    0
 [3,]    1    1   -1    0
 [4,]    1    2    1    0
 [5,]    1    2   -1    0
 [6,]    1    2    1   -1
 [7,]    1    3   -1   -1
 [8,]    1    3    1   -1
 [9,]    1    3   -1   -1
[10,]    1    0    1   -1

and n equal to 1:10. We find, for the final iterations,

Iteration:   34 fold:    4.83068380 fnew:    4.83068066
Iteration:   35 fold:    4.83068066 fnew:    4.83067878
Iteration:   36 fold:    4.83067878 fnew:    4.83067765
Iteration:   37 fold:    4.83067765 fnew:    4.83067697
$lbd
 [1] 3.049407 2.988786 3.049407 2.925556 2.984896 7.968232 7.957861 7.799660
 [9] 7.957861 8.316384

$f
[1] 4.830677

$theta
[1]  1.12628967 -0.02138247 -0.01004005 -1.00197798

Note that if we say

polyLogLin(n,x+3)

then we find the same solution, although much more slowly,

Iteration:  428 fold:    4.83072092 fnew:    4.83071986
Iteration:  429 fold:    4.83071986 fnew:    4.83071882
Iteration:  430 fold:    4.83071882 fnew:    4.83071780
Iteration:  431 fold:    4.83071780 fnew:    4.83071681
$lbd
 [1] 3.049790 2.993221 3.049790 2.932093 2.987506 7.967771 7.952558 7.805050
 [9] 7.952558 8.303460

$f
[1] 4.830717

$theta
[1]  1.053848982 -0.020633792 -0.009361352 -0.999688396