Class LogisticRegression

  • All Implemented Interfaces:
    LinearModel

    public class LogisticRegression
    extends Object
    implements LinearModel
    A logistic regression (sometimes called the logistic model or logit model) is used for prediction of the probability of occurrence of an event by fitting data to a logit function logistic curve. It is a generalized linear model used for binomial regression.

    This particular implementation works with binary data (y).

    See Also:
    • Wikipedia: Logistic regression
    • P. J. MacCullagh and J. A. Nelder, "pp.114, Section 4.4, Likelihood functions for binary data," in Generalized Linear Models, 2nd ed."
    • Constructor Detail

      • LogisticRegression

        public LogisticRegression​(LogisticProblem problem)
        Constructs a Logistic instance.
        Parameters:
        problem - the logistic regression problem to be solved
      • LogisticRegression

        public LogisticRegression​(LMProblem problem)
        Constructs a Logistic instance.
        Parameters:
        problem - the logistic regression problem to be solved
    • Method Detail

      • logLikelihood

        public static RealScalarFunction logLikelihood​(LogisticProblem problem)
        Constructs the log-likelihood function for a logistic regression problem.
        Returns:
        the log-likelihood function
      • Ey

        public double Ey​(Vector x)
        Calculates the probability of occurrence (y = 1).
        Specified by:
        Ey in interface LinearModel
        Parameters:
        x - the independent variables
        Returns:
        the probability of occurrence
      • beta

        public LogisticBeta beta()
        Description copied from interface: LinearModel
        Gets \(\hat{\beta}\) and statistics.
        Specified by:
        beta in interface LinearModel
        Returns:
        \(\hat{\beta}\) and statistics
      • ML

        public double ML()
        Gets the maximum log-likelihood.
        Returns:
        the maximum log-likelihood
      • AIC

        public double AIC()
        Gets the AIC.
        Returns:
        the AIC