Class GeneralizedLinearModel
- java.lang.Object
-
- dev.nm.stat.regression.linear.glm.GeneralizedLinearModel
-
- All Implemented Interfaces:
LinearModel
public class GeneralizedLinearModel extends Object implements LinearModel
The Generalized Linear Model (GLM) is a flexible generalization of the Ordinary Least Squares regression. GLM generalizes linear regression by allowing the linear model to be related to the response variable via a link function and by allowing the magnitude of the variance of each measurement to be a function of its predicted value. In GLM, each outcome of the dependent variables, Y, is assumed to be generated from a particular distribution in the exponential family, a large range of probability distributions that includes the normal, binomial and Poisson distributions, among others. The mean, μ, of the distribution depends on the independent variables, X, throughE(Y) = μ = g-1(Xβ)
where E(Y) is the expected value of Y; Xβ is the linear predictor, a linear combination of unknown parameters, β; g is the link function. The R equivalent function isglm
.- See Also:
- Wikipedia: Generalized linear model
- "P. J. MacCullagh and J. A. Nelder. An algorithm for fitting generalized linear models," in Generalized Linear Models, 2nd ed. pp.40. Section 2.5."
-
-
Constructor Summary
Constructors Constructor Description GeneralizedLinearModel(GLMProblem problem)
Solves a generalized linear problem using the Iterative Re-weighted Least Squares algorithm.GeneralizedLinearModel(GLMProblem problem, GLMFitting fitting)
Constructs aGeneralizedLinearModel
instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description double
AIC()
Gets the Akaike information criterion (AIC).GLMBeta
beta()
Gets the GLM coefficients estimator, β^.double
Ey(Vector x)
Computes the expectation \(E(y(x))\) given an input.GLMResiduals
residuals()
Gets the residual analysis of this GLM regression.
-
-
-
Constructor Detail
-
GeneralizedLinearModel
public GeneralizedLinearModel(GLMProblem problem, GLMFitting fitting)
Constructs aGeneralizedLinearModel
instance.- Parameters:
problem
- the generalized linear regression problem to be solvedfitting
- the fitting method, c.f.,GLMFitting
-
GeneralizedLinearModel
public GeneralizedLinearModel(GLMProblem problem)
Solves a generalized linear problem using the Iterative Re-weighted Least Squares algorithm.- Parameters:
problem
- the generalized linear regression problem to be solved- See Also:
IWLS
-
-
Method Detail
-
Ey
public double Ey(Vector x)
Description copied from interface:LinearModel
Computes the expectation \(E(y(x))\) given an input.- Specified by:
Ey
in interfaceLinearModel
- Parameters:
x
- an input- Returns:
- \(E(y(x))\)
-
beta
public GLMBeta beta()
Gets the GLM coefficients estimator, β^.- Specified by:
beta
in interfaceLinearModel
- Returns:
- the GLM coefficients estimator, β^
-
residuals
public GLMResiduals residuals()
Gets the residual analysis of this GLM regression.- Specified by:
residuals
in interfaceLinearModel
- Returns:
- the residual analysis of this GLM regression
-
AIC
public double AIC()
Gets the Akaike information criterion (AIC).- Returns:
- the Akaike information criterion (AIC)
-
-