SuanShu, a Java numerical and statistical library

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

All Known Subinterfaces:
QuasiFamily
All Known Implementing Classes:
Binomial, Binomial, Family, Gamma, Gamma, Gaussian, Gaussian, InverseGaussian, InverseGaussian, Poisson, Poisson

public interface ExponentialDistribution

This interface represents a probability distribution from the exponential family.

fYi(yi; θi) = exp[(y * θi - b(θi)) / a(φ) + c(y)]
where the parameter θi is called the canonical parameter, b(θi) the cumulant function, and φ the dispersion parameter.

See Also:
"P. J. MacCullagh and J. A. Nelder, Generalized Linear Models, 2nd ed. Chapter 2. Eq. 2.4. pp.28"

Method Summary
 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)
          Overdispersion 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 μ.
 

Method Detail

variance

double variance(double mu)
The variance function of the distribution in terms of the mean μ.

Parameters:
mu - the distribution mean, μ
Returns:
the value of variance function at μ
See Also:
"P. J. MacCullagh and J. A. Nelder, Generalized Linear Models, 2nd ed. Chapter 2. Table 2.1. pp.30"

theta

double theta(double mu)
The canonical parameter of the distribution in terms of the mean μ.

Parameters:
mu - the distribution mean, μ
Returns:
the value of canonical parameter θ at μ
See Also:
"P. J. MacCullagh and J. A. Nelder, Generalized Linear Models, 2nd ed. Chapter 2. Table 2.1. pp.30."

cumulant

double cumulant(double theta)
The cumulant function of the exponential distribution.

Parameters:
theta - the input argument of the cumulant function
Returns:
the value of the cumulant function at (@code θ}
See Also:
"P. J. MacCullagh and J. A. Nelder, Generalized Linear Models, 2nd ed. Chapter 2. Table 2.1. pp.30."

dispersion

double dispersion(Vector y,
                  Vector mu,
                  int nFactors)
Different distribution models have different ways to compute dispersion, φ.

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

Parameters:
y -
mu - μ
nFactors -
Returns:
the dispersion
See Also:
"P. J. MacCullagh and J. A. Nelder, Generalized Linear Models, 2nd ed. Section 2.2.2. Table 2.1."

overdispersion

double overdispersion(Vector y,
                      Vector mu,
                      int nFactors)
Overdispersion 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), 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, Gamma, Gaussian, InverseGaussian, over-dispersion is the same as dispersion.

Parameters:
y -
mu - μ
nFactors -
Returns:
the dispersion
See Also:
"P. J. MacCullagh and J. A. Nelder, Generalized Linear Models, 2nd ed. Section 4.5. Equation 4.23."

deviance

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.
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.

Parameters:
y - the observed value
mu - the estimated mean, μ^
Returns:
the deviance
See Also:
  • P. J. MacCullagh and J. A. Nelder, "Measuring the goodness-of-fit," Generalized Linear Models, 2nd ed. Section 2.3. pp.34.
  • Wikipedia: Deviance

AIC

double AIC(Vector y,
           Vector mu,
           Vector weight,
           double preLogLike,
           double deviance,
           int nFactors)
AIC = 2 * #param - 2 * log-likelihood

Parameters:
y -
mu - μ
weight -
preLogLike - sum of y * θi - b(θi)
deviance -
nFactors -
Returns:
the AIC

SuanShu, a Java numerical and statistical library

Copyright © 2011 Numerical Method Inc. Ltd. All Rights Reserved.