function score = hetscore(y, x, mu)
% *************************************************************************
%
% FILE: hetscore.m
%
% Date Created: Feb 10, 2004
% Author: Mark E. Irwin
%
% Contents: Score 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:
%
%   score: score
%
% *************************************************************************

n = length(y);

score =  (y' * ((y-mu)./(x.^2))/mu^2 - n)/mu;