# SuanShu, a Java numerical and statistical library

com.numericalmethod.suanshu.stats.regression.linear.glm.distribution

## Class GLMInverseGaussian

• java.lang.Object
• com.numericalmethod.suanshu.stats.regression.linear.glm.distribution.GLMInverseGaussian
• All Implemented Interfaces:
GLMExponentialDistribution
Direct Known Subclasses:
QuasiInverseGaussian

public class GLMInverseGaussian
extends Object
implements GLMExponentialDistribution
This is the Inverse Gaussian distribution of the error distribution in GLM model.

The R equivalent function is inverse.gaussian.

• ### Constructor Summary

Constructors
Constructor and Description
GLMInverseGaussian()
• ### Method Summary

All Methods
Modifier and Type Method and Description
double AIC(Vector y, Vector mu, Vector weight, double prelogLike, double deviance, int nFactors)
AIC = 2 * #param - 2 * log-likelihood
double cumulant(double theta)
The cumulant function of the exponential distribution.
double deviance(double y, double mu)
Deviance D(y;μ^) measures the goodness-of-fit of a model, which is defined as the difference between the maximum log likelihood achievable and that achieved by the model.
double dispersion(Vector y, Vector mu, int nFactors)
Different distribution models have different ways to compute dispersion, Φ.
double overdispersion(Vector y, Vector mu, int nFactors)
Over-dispersion is the presence of greater variability (statistical dispersion) in a data set than would be expected based on the nominal variance of a given simple statistical model.
double theta(double mu)
The canonical parameter of the distribution in terms of the mean μ.
double variance(double mu)
The variance function of the distribution in terms of the mean μ.
• ### Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
• ### Constructor Detail

• #### GLMInverseGaussian

public GLMInverseGaussian()
• ### Method Detail

• #### variance

public double variance(double mu)
Description copied from interface: GLMExponentialDistribution
The variance function of the distribution in terms of the mean μ.
Specified by:
variance in interface GLMExponentialDistribution
Parameters:
mu - the distribution mean, μ
Returns:
the value of variance function at μ
"P. J. MacCullagh and J. A. Nelder, "Chapter 2, Table 2.1, pp.30," Generalized Linear Models, 2nd ed."
• #### theta

public double theta(double mu)
Description copied from interface: GLMExponentialDistribution
The canonical parameter of the distribution in terms of the mean μ.
Specified by:
theta in interface GLMExponentialDistribution
Parameters:
mu - the distribution mean, μ
Returns:
the value of canonical parameter θ at μ
"P. J. MacCullagh and J. A. Nelder, "Chapter 2, Table 2.1, pp.30," Generalized Linear Models, 2nd ed."
• #### cumulant

public double cumulant(double theta)
Description copied from interface: GLMExponentialDistribution
The cumulant function of the exponential distribution.
Specified by:
cumulant in interface GLMExponentialDistribution
Parameters:
theta - θ
Returns:
the value of the cumulant function at θ
"P. J. MacCullagh and J. A. Nelder, "Chapter 2, Table 2.1, pp.30," Generalized Linear Models, 2nd ed."
• #### deviance

public double deviance(double y,
double mu)
Description copied from interface: GLMExponentialDistribution
Deviance D(y;μ^) measures the goodness-of-fit of a model, which is defined as the difference between the maximum log likelihood achievable and that achieved by the model.
D(y;μ^) = 2 * [l(y;y) - l(μ^;y)]
where l is the log-likelihood.

For an exponential family distribution, this is equivalent to

2 * [(y * θ(y) - b(θ(y))) - (y * θ(μ^) - b(θ(μ^)]
where b is the cumulant function of the distribution.
Specified by:
deviance in interface GLMExponentialDistribution
Parameters:
y - an observation
mu - the estimated mean, μ^
Returns:
the deviance
• P. J. MacCullagh and J. A. Nelder, "Section 2.3, pp.34, Measuring the goodness-of-fit," Generalized Linear Models, 2nd ed.
• Wikipedia: Deviance
• #### overdispersion

public double overdispersion(Vector y,
Vector mu,
int nFactors)
Description copied from interface: GLMExponentialDistribution
Over-dispersion is the presence of greater variability (statistical dispersion) in a data set than would be expected based on the nominal variance of a given simple statistical model.

σ^2 = X^2/(n-p), eq. 4.23
X^2 = sum{(y-μ)^2}/V(μ), p.34
= sum{(y-μ)^2}/b''(θ), p.29

X^2 estimates a(Φ) = Φ, the dispersion parameter (assuming w = 1).

For, GLMGamma, GLMGaussian, GLMInverseGaussian, over-dispersion is the same as dispersion.

Specified by:
overdispersion in interface GLMExponentialDistribution
Parameters:
y - an observation
mu - the distribution mean, μ
nFactors - the number of factors
Returns:
the dispersion
"P. J. MacCullagh and J. A. Nelder, "Section 4.5, Equation 4.23," Generalized Linear Models, 2nd ed."
• #### dispersion

public double dispersion(Vector y,
Vector mu,
int nFactors)
Description copied from interface: GLMExponentialDistribution
Different distribution models have different ways to compute dispersion, Φ.

Note that in R's output, this is called "over-dispersion".

Specified by:
dispersion in interface GLMExponentialDistribution
Parameters:
y - an observation
mu - the distribution mean, μ
nFactors - the number of factors
Returns:
the dispersion
"P. J. MacCullagh and J. A. Nelder, "Section 2.2.2, Table 2.1," Generalized Linear Models, 2nd ed."
• #### AIC

public double AIC(Vector y,
Vector mu,
Vector weight,
double prelogLike,
double deviance,
int nFactors)
Description copied from interface: GLMExponentialDistribution
AIC = 2 * #param - 2 * log-likelihood
Specified by:
AIC in interface GLMExponentialDistribution
Parameters:
y - an observation
mu - the distribution mean, μ
weight - the weights assigned to the observations
prelogLike - sum of (yi * θi - b(θi))
deviance - the deviance
nFactors - the number of factors
Returns:
the AIC the Akaike information criterion