| families {aster} | R Documentation |
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.
fam.bernoulli() fam.poisson() fam.truncated.poisson(truncation) fam.negative.binomial(size) fam.truncated.negative.binomial(size, truncation) fam.normal.location(sd) fam.default() famfun(fam, deriv, theta)
truncation |
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. |
Currently implemented families are
"bernoulli""poisson""truncated.poisson"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
mu [ 1 - (k + 1) / (1 + beta) ( 1 - (k + 1) / mu * beta / (1 + beta) ) ]
.
"negative.binomial"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"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"mu = sigma^2 theta
and the second derivative has the value
sigma^2.
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.
### 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))