varianceFamily {EQL}R Documentation

Variance Family Class For The EQL-Method


varianceFamily provides a class for a parameterized family of variance functions to be used with eql.

The predefined functions powerVarianceFamily and extBinomialVarianceFamily compute the variance family defined by the parametric variance functions V_\theta(\mu) = \mu^\theta and V_{k,l}(\mu) = \mu^k(1-\mu)^l, respectively.


varianceFamily(varf, devf = NULL, link = "log", initf = NULL,
               validmuf = NULL, name = "default")

powerVarianceFamily(link = "log")
extBinomialVarianceFamily(link = "logit")



the parameterized variance function.


the deviance function. If NULL (the default) it will be determined numerically from the variance function varf.


the link function.


a function returning an object of class expression. The expression object should give a sequence of initializing commands for the glm routine such as setting the starting values. If NULL (the default), a very rudimentary initialize function is chosen, which may not be appropriate. See family for further details.


a function giving TRUE if its argument is a valid value for \mu and FALSE otherwise. If NULL (the default), all \mu are supposed to be valid.


a character string giving the name of the variance family.


The purpose of the function varianceFamily is to provide a convenient way to specify families of variance functions. An extended glm family object for a particular choice of a parameter vector can be obtained via the class member family.

The minimal specification for a varianceFamily object is the variance function V_\theta(\mu) with \theta describing the vector of family parameters. If not given explicitly, the deviance function is determined numerically.

The family parameter of powerVarianceFamily is ‘theta’, while the names of the parameters of extBinomialVarianceFamily are ‘k’ and ‘l’.


varianceFamily returns an object of class varianceFamily containing the following components:


a function which computes an extFamily object, which is an extension of the family object known from classical glm. extFamily inherits from class family and contains an additional field holding the value of the particular parameters at which the family was evaluated.


a character string giving the name of the variance family.


a list of the parameters of the variance family.

a character string. Equals either “explicit” or “numerical” depending on how the deviance function was determined.


Those arguments passed to varianceFunction that are functions, are supposed to accept the variance family's parameter as an argument. The idea is that any of these functions may give different results for different values of the family's parameters. Even if any of these functions do not depend on these parameters, they must be contained in the function's argument list.


Thorn Thaler


Nelder, J.A. and Pregibon, D. (1987). An Extended Quasi-Likelihood Function. Biometrika, 74, 221–232.

See Also

family, eql


# The extended binomial variance family
# (the deviance is determined numerically)

# init does not depend on k and l but it must accept
# these parameters anyways
init <- function(k, l) {
    mustart <- (weights * y + 0.5)/(weights + 1)
    n <-, nobs)}))
validmuf <- function(mu, k, l) {
  return(all(mu > 0) && all(mu < 1))
varf <- function(y, k, l)  y^k*(1-y)^l
suppressWarnings(vf <- varianceFamily(varf=varf, link="log", initf=init, 
vf$family(1,1) # corresponds to binomial()

y <- runif(10, 0, 1)
mu <- runif(10, 0, 1)

all.equal(vf$family(1,1)$dev.resids(y,mu,1),     # TRUE

[Package EQL version 1.0-1 Index]