Class LogisticRegression


  • public abstract class LogisticRegression
    extends java.lang.Object
    This program fits a logistic regression model on a given data set. We find the maximum likelihood estimators by using Newton's method to find the zero of the gradient of the likelihood function.
    • Field Detail

      • numberOfDepVars

        protected final int numberOfDepVars
      • maximumNumberOfSamples

        protected final int maximumNumberOfSamples
      • dim

        protected final int dim
      • beta

        public double[] beta
      • zStats

        public double[] zStats
      • pValues

        public double[] pValues
      • numberOfIterations

        public int numberOfIterations
      • gradient

        protected final double[] gradient
      • hessian

        protected final double[][] hessian
      • delta

        protected final double[] delta
      • numberOfSamples

        protected int numberOfSamples
      • oneOver

        protected final double[] oneOver
      • gradMult

        protected final double[] gradMult
      • prod

        protected final double[] prod
    • Constructor Detail

      • LogisticRegression

        protected LogisticRegression​(int numberOfDepVars,
                                     int maximumNumberOfSamples)
    • Method Detail

      • getGorLogisticRegressionObject

        public static LogisticRegression getGorLogisticRegressionObject​(int numberOfDepVars,
                                                                        int maximumNumberOfSamples)
      • runRegression

        public boolean runRegression​(double[][] x,
                                     boolean[] y,
                                     int numberOfSamples,
                                     double tol,
                                     int maxIter)
      • computeTestStats

        protected abstract void computeTestStats()
      • updateGradientAndHessian

        protected abstract void updateGradientAndHessian​(double[][] x,
                                                         boolean[] y)
      • updateGradientAndHessianFirstRun

        protected abstract void updateGradientAndHessianFirstRun​(double[][] x,
                                                                 boolean[] y)