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 |
link |
the link function. |
initf |
a function returning an object of class
|
validmuf |
a function giving |
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 |
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
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))