Class LogisticRegression
- java.lang.Object
-
- dev.nm.stat.regression.linear.logistic.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 Summary
Constructors Constructor Description LogisticRegression(LMProblem problem)Constructs a Logistic instance.LogisticRegression(LogisticProblem problem)Constructs a Logistic instance.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description doubleAIC()Gets the AIC.LogisticBetabeta()Gets \(\hat{\beta}\) and statistics.doubleEy(Vector x)Calculates the probability of occurrence (y = 1).static RealScalarFunctionlogLikelihood(LogisticProblem problem)Constructs the log-likelihood function for a logistic regression problem.doubleML()Gets the maximum log-likelihood.LogisticResidualsresiduals()Gets the residual analysis of an OLS regression.
-
-
-
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:
Eyin interfaceLinearModel- Parameters:
x- the independent variables- Returns:
- the probability of occurrence
-
beta
public LogisticBeta beta()
Description copied from interface:LinearModelGets \(\hat{\beta}\) and statistics.- Specified by:
betain interfaceLinearModel- Returns:
- \(\hat{\beta}\) and statistics
-
residuals
public LogisticResiduals residuals()
Description copied from interface:LinearModelGets the residual analysis of an OLS regression.- Specified by:
residualsin interfaceLinearModel- Returns:
- the residual analysis
-
ML
public double ML()
Gets the maximum log-likelihood.- Returns:
- the maximum log-likelihood
-
AIC
public double AIC()
Gets the AIC.- Returns:
- the AIC
-
-