SuanShu, a Java numerical and statistical library

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

java.lang.Object
  extended by com.numericalmethod.suanshu.stats.regression.linear.glm.distribution.Family
All Implemented Interfaces:
ExponentialDistribution
Direct Known Subclasses:
Binomial, Gamma, Gaussian, InverseGaussian, Poisson

public abstract class Family
extends java.lang.Object
implements ExponentialDistribution

Family is a description of the error distribution and link function to be used in the GLM model.

The R equivalent function is family.


Constructor Summary
Family(LinkFunction link)
          Construct an instance of Family.
 
Method Summary
 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.
 LinkFunction link()
          Get the link function of this distribution.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.numericalmethod.suanshu.stats.regression.linear.glm.distribution.ExponentialDistribution
AIC, cumulant, dispersion, overdispersion, theta, variance
 

Constructor Detail

Family

public Family(LinkFunction link)
Construct an instance of Family.

Parameters:
link - the link function of this distribution
Method Detail

link

public LinkFunction link()
Get the link function of this distribution.

Returns:
the link function of this distribution

deviance

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

The definition above is the default implementation of this function, a subclass of ExponentialDistribution may override this function to implement a simplified expression for efficiency or handle special values.

Specified by:
deviance in interface ExponentialDistribution
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

SuanShu, a Java numerical and statistical library

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