Families (response models) known to the package.
These functions construct simple family specifications used
in specifying models for aster and mlogl.
They are mostly for convenience, since the specifications are easy
to construct by hand.
the truncation point, called k in the details
section below.
size
the sample size. May be non-integer.
sd
the standard deviation. May be non-integer.
fam
a family specification, which is a list of class "astfam"
containing, at least one element named "name" and perhaps other
elements specifying hyperparameters.
deriv
derivative wanted: 0, 1, or 2.
theta
value of the canonical parameter.
Details
Currently implemented families are
"bernoulli"
Bernoulli. The mean value parameter
mu is the success probability. The canonical parameter is
theta = log(mu) - log(1 - mu),
also called logit of mu. The first derivative of the
cumulant function has the value mu and the second derivative
of the cumulant function has the value mu (1 - mu).
"poisson"
Poisson. The mean value parameter
mu is the mean of the Poisson distribution.
The canonical parameter is theta = log(mu).
The first and second derivatives of the cumulant function both have
the value mu.
"truncated.poisson"
Poisson conditioned on being
strictly greater than k, specified by
the argument truncation.
Let mu be the mean of the corresponding untruncated
Poisson distribution. Then the canonical parameters for both
truncated and untruncated distributions are the same
theta = log(mu).
Let Y be a Poisson random variable having the same mean parameter
as this distribution, and define
beta = Pr(Y > k + 1) / Pr(Y = k + 1)
Then the mean value parameter and first derivative of the
cumulant function of this distribution has the value
tau = mu + (k + 1) / (1 + beta)
and the second derivative of the cumulant function has the value
Negative binomial. The size parameter
alpha may be noninteger, meaning the cumulant function
is alpha times the cumulant function of the geometric
distribution. The mean value parameter mu is the mean of
the negative binomial distribution. The success probability parameter
is
p = alpha / (mu + alpha).
The canonical parameter
is theta = log(1 - p).
Since 1 - p < 1, the canonical parameter space is restricted,
the set of theta such that theta < 0.
This is, however, a
regular exponential family (the log likelihood goes to minus infinity
as theta converges to the boundary of the parameter space,
so the constraint theta < 0 plays no role in maximum
likelihood estimation so long as the optimization software is not too
stupid. There will be no problems so long as the default optimizer
(trust) is used. Since zero is not in the canonical
parameter space a negative default origin is used. The first derivative
of the cumulant function has the value
mu = alpha (1 - p) / p
and the second derivative has the value
mu = alpha (1 - p) / p^2
.
"truncated.negative.binomial"
Negative binomial conditioned
on being strictly greater than k, specified by
the argument truncation.
Let p be the success probability parameter of the corresponding
untruncated negative binomial distribution. Then the canonical
parameters for both
truncated and untruncated distributions are the same
theta = log(1 - p), and consequently
the canonical parameter spaces are the same,
the set of theta such that theta < 0,
and both models are regular exponential families.
Let Y be an untruncated negative binomial random variable having
the same size and success probability parameters as this distribution.
and define
beta = Pr(Y > k + 1) / Pr(Y = k + 1)
Then the mean value parameter and first derivative of the
cumulant function of this distribution has the value
tau = mu + (k + 1) / (p (1 + beta))
and the second derivative is too complicated to write here (the
formula can be found in the vignette trunc.pdf.
"normal.location"
Normal, unknown mean, known variance.
The sd (standard deviation) parameter
sigma may be noninteger, meaning the cumulant function
is sigma^2 times the cumulant function of the standard
normal distribution. The mean value parameter mu is the
mean of the normal distribution.
The canonical parameter
is theta = mu / sigma^2.
The first derivative of the cumulant function has the value
mu = sigma^2 theta
and the second derivative has the value
sigma^2.
Value
For all but fam.default,
a list of class "astfam" giving name and values of any
hyperparameters.
For fam.default,
a list each element of which is of class "astfam".
The list of families which were hard coded in earlier versions of the
package.
See Also
aster and mlogl
Examples
### mean of poisson with mean 0.2
famfun(fam.poisson(), 1, log(0.2))
### variance of poisson with mean 0.2
famfun(fam.poisson(), 2, log(0.2))
### mean of poisson with mean 0.2 conditioned on being nonzero
famfun(fam.truncated.poisson(trunc = 0), 1, log(0.2))
### variance of poisson with mean 0.2 conditioned on being nonzero
famfun(fam.truncated.poisson(trunc = 0), 2, log(0.2))