Objects of class "familyWALS"
inherit from "family"
and extend those with (transformation) functions required for
walsGLM
and walsNB
.
familyWALS(object, ...)poissonWALS(link = "log")
binomialWALS(link = "logit")
negbinFixedWALS(scale, link)
negbinWALS(scale, link)
# S3 method for walsGLM
familyWALS(object, ...)
An object of class "familyWALS"
to be used in
walsGLM
that inherits from "family"
.
This is a list that contains elements returned from the corresponding family
function that it extends. Additionally, the following elements are available:
function. Derivative of the canonical parameter \(\theta\) with respect to the linear link \(\eta\), i.e. \(d \theta / d \eta\).
function. \(\psi\) defined on p. 3 of deluca2018glmWALS.
function. Preprocesses the response, e.g. in
binomialWALS()
it transforms factors to numeric 0s and 1s.
function. Transforms the response to \(\bar{y}\).
See eq. (5) in deluca2018glmWALS for GLMs and
huynhwalsnbWALS for negbinWALS()
used in
walsNB
.
function. Transforms the regressors to \(\bar{X}_1\) and
\(\bar{X}_2\), respectively. See eq. (5) in deluca2018glmWALS
for GLMs and huynhwalsnbWALS for negbinWALS()
used in
walsNB
.
function. The probability density/mass function of the family.
poissonWALS()
and negbinFixedWALS()
return objects of class
"familyWALScount"
that inherit from "familyWALS"
and
"family"
. These are lists that contain the same elements as
"familyWALS"
objects described above.
negbinWALS()
creates an object of class "familyNBWALS"
(only used internally in walsNB
) that inherits from
"familyWALScount"
, "familyWALS"
and "family"
.
This is a list that contains all elements returned from negbinFixed
and the elements described above for objects of class "familyWALS"
.
Additionally contains the following elements with functions required in
walsNB
that are described in
huynhwalsnbWALS:
function. Computes \(\bar{q}\).
function. Computes \(\bar{g}\).
function. Computes \(\bar{y}_0\).
function. Computes \(\bar{t}\).
function. Computes \(\bar{\epsilon}\).
function. Computes \(\bar{\epsilon}^{-1}\).
function. Computes \(\bar{\kappa}^{\top} \mathbf{1}\).
function. Computes the log-dispersion parameter \(\log(\rho)\) given (model-averaged) estimates of the regression coefficients of the transformed regressors \(\gamma_{1}\) and \(\gamma_{2}\).
The function familyWALS()
extracts the family objects stored
in "walsGLM"
objects.
Further arguments passed to methods.
The negbinWALS()
family currently only accepts "log"
, while
negbinFixedWALS()
supports both "log"
and "canonical"
.
Specifies the model link function. Typically a character string
or an object of class "link-glm"
generated by
make.link
. See family
for more details.
Currently, only a limited number of links are supported. See below for more
details.
dispersion parameter of NB2 to be used, always larger than 0.
familyWALS()
is a generic function that extracts the family used in
"walsGLM"
objects.
negbinFixedWALS()
creates the "familyWALS"
object for negative
binomial distribution type 2 (NB2) with fixed dispersion parameter. It extends
negativeBinomial
.
negbinWALS()
creates objects of the specialized class "familyNBWALS"
which inherits from "familyWALS"
and "family"
. It constructs the
"familyNBWALS"
object for the negative binomial distribution type 2 (NB2)
with variable dispersion parameter by extending negativeBinomial
and negbinFixedWALS
with functions required in walsNB.
negbinWALS
should only be used in walsNBfit
and
not in walsGLM
because the NB2 with variable dispersion
parameter is not a GLM!
Currently, binomialWALS()
and poissonWALS()
only support their
canonical links, i.e. "logit"
and "log"
, respectively.
negbinFixedWALS()
supports both, the "canonical"
link and
the "log"
link, however, the first is not recommended due to numerical
difficulties in the fitting process. In contrast, negbinWALS()
only
supports the "log"
link.
family, walsGLM.
## Use in walsGLM():
data("NMES1988", package = "AER")
NMES1988 <- na.omit(NMES1988)
fitPoisson <- walsGLM(emergency ~ health + chronic + age + gender |
I((age^2)/10) + married + region, family = poissonWALS(),
data = NMES1988, prior = laplace())
summary(fitPoisson)
## Plot derivatives of binomialWALS() with default 'logit' link:
bi <- binomialWALS()
plot(bi$mu.eta, from = -10, to = 10)
plot(bi$theta.eta, from = -10, to = 10) # constant. logit is canonical link
Run the code above in your browser using DataLab