varianceFamily {EQL}R Documentation

Variance Family Class For The EQL-Method

Description

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.

Usage

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

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

Arguments

varf

the parameterized variance function.

devf

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

link

the link function.

initf

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.

validmuf

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.

name

a character string giving the name of the variance family.

Details

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

Value

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

family

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.

name

a character string giving the name of the variance family.

params

a list of the parameters of the variance family.

type.dev

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

Note

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.

Author(s)

Thorn Thaler

References

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

See Also

family, eql

Examples

# 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) {
  return(expression({
    mustart <- (weights * y + 0.5)/(weights + 1)
    n <- rep.int(1, 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, 
                        validmuf=validmuf,
                        name="Extended-Binomial-Family"))
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
          binomial()$dev.resids(y,mu,1))    


[Package EQL version 1.0-1 Index]