% BINARY LOGISTIC REGRESSION ESTIMATION - WITH GLOBAL VAR FUDGE.
% Returns the maximum likelihood estimate for the parameters of a 
% logistic regression model.  The inputs in the training cases are in X, which 
% should be a matrix with one row per training case and one column per input 
% variable.  The training targets are in y, which should be a vector of 0/1 
% values.  The first element of the parameter vector returned is the intercept;
% the remaining elements are the coefficients of the inputs. 

function est = lr2est (y, X)

  global lr_y
  global lr_X

  lr_y = y;
  lr_X = X;

  est = fminsearch (@lr2loglike, zeros(1,size(X,2)+1));
