Nelder and Pregibon [8] and McCullagh and Nelder [7], Chapter 9 discuss quasi-likelihood, where the complete error distribution need not be specified; all that is required is information about the first two moments (the mean and the variance). As an example, consider including a new distribution specified by the variance function
V(µ)=µ4.This variance function defines one of the Tweedie family of distributions (defined in Tweedie [10]), sometimes called a positive stable distribution.
To incorporate such a distribution in glmlab, proceed as follows:
%Calculate if strcmp(what,'varfn'), %%%In here, you need lines to find the variance function %%%from mu and y. %%%The section should return the variance function as answ elseif strcmp(what,'scdev'); %%%In here, you need lines to find the scaled deviance %%%from mu and y. %%%The section should return the scaled deviance as answ end;
It
should be clear that there are two sections to alter: One section
requires information about the variance function, and the other about
the deviance. For the variance function given in Equation (5.7),
the MATLAB equivalent code is
answ = mu .^ 4;
This line should be entered into the section requiring information
about the variance function.
The deviance can be found from the integral
D(y,µ)=-2INTyµ(y-u)/(V(u)) du,which, for the given variance function, is
D=(1)/(6y2) + (y)/(3µ3)-(1)/(2µ2).The equivalent MATLAB code is
answ=1/(6*y^2) + ( y./(3*mu.^3) ) - ( 1/(2*mu.^2) ); dfourpwr.m
A similar procedure is used for defining new link functions, but the corresponding files in the link subdirectory of the fit directory are used. Adding new distribution or link functions is not recommended unless the user knows the use of the distribution or link function, as odd results may eventuate otherwise.