## Class QuasiGLMNewtonRaphson

• java.lang.Object
• dev.nm.stat.regression.linear.glm.quasi.QuasiGLMNewtonRaphson
• All Implemented Interfaces:
GLMFitting

public class QuasiGLMNewtonRaphson
extends Object
implements GLMFitting
The Newton-Raphson method is an iterative algorithm to estimate the β of the quasi GLM regression. It is a maximum likelihood method.
• "P. J. MacCullagh and J. A. Nelder, "pp.327, An algorithm for fitting generalized linear models," in Generalized Linear Models, 2nd ed."
• Wikipedia: Fitting
• ### Constructor Summary

Constructors
Constructor Description
QuasiGLMNewtonRaphson​(double epsilon, int maxIterations)
Constructs an instance to run the Newton-Raphson method.
• ### Method Summary

All Methods
Modifier and Type Method Description
ImmutableVector betaHat()
Gets the estimates of β, β^, as in E(Y) = μ = g-1(Xβ)
ImmutableMatrix D()
Computes D.
ImmutableMatrix DVInv()
Computes D / V(μ).
void fit​(GLMProblem problem, Vector beta0Initial)
Fits a Generalized Linear Model.
double logLikelihood()
ImmutableVector mu()
Gets μ as in E(Y) = μ = g-1(Xβ)
ImmutableVector weights()
Gets the weights assigned to the observations.
• ### Methods inherited from class java.lang.Object

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

• #### QuasiGLMNewtonRaphson

public QuasiGLMNewtonRaphson​(double epsilon,
int maxIterations)
Constructs an instance to run the Newton-Raphson method.
Parameters:
epsilon - a precision parameter: when a number |x| ≤ ε, it is considered 0
maxIterations - the maximum number of iterations
• ### Method Detail

• #### fit

public void fit​(GLMProblem problem,
Vector beta0Initial)
Description copied from interface: GLMFitting
Fits a Generalized Linear Model.

This method must be called before the three get methods.

Specified by:
fit in interface GLMFitting
Parameters:
problem - the generalized linear regression problem to be solved
beta0Initial - initial guess for β^
• #### mu

public ImmutableVector mu()
Description copied from interface: GLMFitting
Gets μ as in
E(Y) = μ = g-1(Xβ)
Specified by:
mu in interface GLMFitting
Returns:
μ
• #### betaHat

public ImmutableVector betaHat()
Description copied from interface: GLMFitting
Gets the estimates of β, β^, as in
E(Y) = μ = g-1(Xβ)
Specified by:
betaHat in interface GLMFitting
Returns:
β^
• #### logLikelihood

public double logLikelihood()
Specified by:
logLikelihood in interface GLMFitting
• #### weights

public ImmutableVector weights()
Description copied from interface: GLMFitting
Gets the weights assigned to the observations.
Specified by:
weights in interface GLMFitting
Returns:
the weights
• #### D

public ImmutableMatrix D()
Computes D.
D = d(μ)/d(β) = (dμ/dη) * (dη/dβ)
Returns:
D
• #### DVInv

public ImmutableMatrix DVInv()
Computes D / V(μ).
Returns:
D / V(μ)