function hess = hethess(y, x, mu)
% *************************************************************************
%
% FILE: hethess.m
%
% Date Created: Feb 10, 2004
% Author: Mark E. Irwin
%
% Contents: Hessian function for the model Y ~ N(mu, (mu*x)^2)
%
% Revision History
% Date          Name            Changes/Reasons
%
% *************************************************************************
%
% Input:
%
%   y: response vector
%   x: variance covariate vector
%   mu: initial guess for MLE
%
% Output:
%
%   hess: hessian
%
% *************************************************************************

n = length(y);
x2 = x.^2;

hess =  (n - 3 * y' * ((y-mu)./x2)/mu^2  - ones(1, n) * (y ./ x2) / mu) / mu^2;