next up previous
Next: Fitting a Bradley-Terry Up: Structure of the Previous: Error Structures

Link Structures

The link function g for a generalized linear model relates the linear predictor to the mean response by

Links are implemented as objects. Table 1 lists the pre-defined link functions, along with the expressions used to return link objects.

   
Table 1: Link Functions and Expression for Obtaining Link Objects

With one exception, the pre-defined links require no parameters. These link objects can therefore be shared among models. The exception is the power link. Links for binomial models are defined for n = 1 trials and assume .

Link objects inherit from the ="2D glim-link-proto=-1 prototype. The ="2D log-link=-1 object, for example, is constructed by

(defproto log-link () () glim-link-proto)

Since this prototype can be used directly in model objects, the convention of having prototype names end in ="2D -proto=-1 is not used. The ="2D glim-link-proto=-1 prototype provides a ="2D :print=-1 method that should work for most link functions. The ="2D log-link=-1 object prints as
> log-link
#<Glim Link Object: LOG-LINK>

The ="2D glim-proto=-1 computing methods assume that a link object responds to three messages: (send link :eta mu )
(send link :means eta )
(send link :derivs mu )

The ="2D :eta=-1 method returns a sequence of linear predictor values for a particular mean sequence. The ="2D :means=-1 method is the inverse of ="2D :eta=-1 : it returns mean values for specified values of the linear predictor. The ="2D :derivs=-1 method returns the values of

at the specified mean values. As an example, for the ="2D log-link=-1 object these three methods are defined as

(defmeth log-link :eta (mu) (log mu))
(defmeth log-link :means (eta) (exp eta))
(defmeth log-link :derivs (mu) (/ mu))

Alternative link structures can be constructed by setting up a new prototype and defining appropriate ="2D :eta=-1 , ="2D :means=-1 , and ="2D :derivs=-1 methods. Parametric link families can be implemented by providing one or more slots for holding the parameters. The power link is an example of a parametric link family. The power link prototype is defined as

(defproto power-link-proto '(power) () glim-link-proto)

The slot ="2D power=-1 holds the power exponent. An accessor method is defined by
(defmeth power-link-proto :power () (slot-value 'power))

and the ="2D :isnew=-1 initialization method is defined to require a power argument:
(defmeth power-link-proto :isnew (power) (setf (slot-value 'power) power))

Thus a power link for a particular exponent, say the exponent 2, can be constructed using the expression
(send power-link-proto :new 2)

To complete the power link prototype, we need to define the three required methods. They are defined as

(defmeth power-link-proto :eta (mu) (^ mu (send self :power)))

(defmeth power-link-proto :means (eta) (^ eta (/ (slot-value 'power))))

and
(defmeth power-link-proto :derivs (mu)
  (let ((p (slot-value 'power)))
    (* p (^ mu (- p 1)))))

The definition of the ="2D :means=-1 method could be improved to allow negative arguments when the power is an odd integer. Finally, the ="2D :print=-1 method is redefined to reflect the value of the exponent:
(defmeth power-link-proto :print (&optional (stream t))
  (format stream ``#<Glim Link Object: Power Link (~s)>'' (send self :power)))

Thus a square link prints as
> (send power-link-proto :new 2)
#<Glim Link Object: Power Link (2)>



next up previous
Next: Fitting a Bradley-Terry Up: Structure of the Previous: Error Structures



Anthony Rossini
Fri Oct 20 08:28:51 EDT 1995