reaster {aster} | R Documentation |
Aster Models with Random Effects
Description
Fits Aster Models with Random Effects using Laplace Approximation.
Usage
reaster(fixed, random, pred, fam, varvar, idvar, root,
famlist = fam.default(), origin, data, effects, sigma, response)
Arguments
fixed |
either a model matrix or a formula specifying response and model matrix. The model matrix for fixed effects. |
random |
either a model matrix or list of model matrices or a formula or a list of formulas specifying a model matrix or matrices. The model matrix or matrices for random effects. Each model matrix specifies the random effects for one variance component. |
pred |
an integer vector of length |
fam |
an integer vector of length |
varvar |
a variable whose length is the row dimension of all model
matrices that is a factor whose levels are character strings
treated as variable names. The number of variable names is |
idvar |
a variable whose length is the row dimension of all model
matrices. The number of individuals is |
root |
a vector whose length is the row dimension of all model matrices. For nodes whose predecessors are root nodes specifies the value of the constant at that root node. Typically the vector having all components equal to one. |
famlist |
a list of family specifications (see |
origin |
a vector whose length is the row dimension of all model
matrices. Distinguished point in parameter space. May be missing,
in which case an unspecified default is provided. See details of
|
data |
an optional data frame containing the variables
in the model. If not found in |
effects |
if not missing, a vector specifying starting values for
all effects, fixed and random. Length is the sum of the column dimensions
of all model matrices. If supplied, the random effects part should be
standardized (random effects divided by their standard deviations, like
the component |
sigma |
if not missing, a vector specifying starting values for
the square roots of the variance components. Length is the number
of model matrices for
random effects (the length of the list |
response |
if not missing, a vector specifying the response. Length
is the row dimension of all model matrices. If missing, the response
is determined by the response in the formula |
Details
See the help page for the function aster
for specification
of aster models. This function only fits unconditional aster models
(those with default values of the aster
function arguments
type
and origin.type
.
The only difference between this function and the aster
function is
that some effects are treated as random. The unconditional canonical
parameter vector of the aster model is treated as an affine function of
fixed and random effects
\varphi = M \beta + \sum_{i = 1}^k \sigma^2_i Z_i b_i
where M
and the Z_i
are model matrices specified by
the arguments fixed
and random
, where \beta
is a vector of
fixed effects and each b_i
is a vector of random
effects that are assumed to be (marginally) normally distributed with
mean vector zero and variance matrix \sigma_i^2
times
the identity matrix.
The vectors of random effects b_i
are not parameters, rather
they are latent (unobservable, hypothetical) variables. The square roots
of the variance components \sigma_i
are parameters as
are the components of \beta
.
This function maximizes an approximation to the likelihood introduced by Breslow and Clayton (1993). See Geyer, et al. (2013) for details.
Value
reaster
returns an object of class inheriting from "reaster"
.
An object of class "reaster"
is a list containing at least the
following components:
obj |
The aster object returned by a call to the |
fixed |
the model matrix for fixed effects. |
random |
the model matrix or matrices for random effects. |
dropped |
names of columns dropped from the fixed effects matrix. |
sigma |
approximate MLE for square roots of variance components. |
nu |
approximate MLE for variance components. |
c |
penalized likelihood estimates for the |
b |
penalized likelihood estimates for the random effects. |
alpha |
approximate MLE for fixed effects. |
zwz |
|
response |
the response vector. |
origin |
the origin (offset) vector. |
iterations |
number of iterations of trust region algorithm in
each iteration of re-estimating |
counts |
number of iterations of Nelder-Mead in initial optimization of approximate missing data log likelihood. |
deviance |
up to a constant, minus twice the maximized value of
the Breslow-Clayton approximation to the
log-likelihood. (Note the minus. This is somewhat counterintuitive,
but agrees with the convention used by the |
Calls to reaster.formula
return a list also containing:
call |
the matched call. |
formula |
the formulas supplied. |
NA Values
It was almost always wrong for aster model data to have NA
values.
Although theoretically possible for the R formula mini-language to do the
right thing for an aster model with NA
values in the data, usually
it does some wrong thing. Thus, since version 0.8-20, this function and
the aster
function give errors when used with data having
NA
values. Users must remove all NA
values (or replace them
with what they should be, perhaps zero values) “by hand”.
Warning about Negative Binomial
The negative binomial and truncated negative binomial are fundamentally
incompatible with random effects. The reason is that the canonical parameter
space for a one-parameter negative binomial or truncated negative binomial
is the negative half line. Thus the conditional canonical parameter
\theta
for such a node must be negative valued. The aster
transform is so complicated that it is unclear what the corresponding
constraint on the unconditional canonical parameter \varphi
is,
but there is a constraint: its parameter space is not the whole real line.
A normal random effect, in contrast, does have support the whole real line.
It wants to make parameters that are constrained to have any real number.
The code only warns about this situation, because if the random effects do
not influence any negative binomial or truncated negative binomial nodes
of the graph, then there would be no problem.
Warning about Individual Random Effects
The Breslow-Clayton approximation assumes the complete data log likelihood is approximately quadratic considered as a function of random effects only. This will be the case by the law of large numbers if the number of individuals is much larger than the number of random effects. Thus Geyer, et al. (2013) warn against trying to put a random effect for each individual in the model. If you do that, the code will try to fit the model, but it will take forever and no theory says the results will make any sense.
References
Breslow, N. E., and Clayton, D. G. (1993). Approximate Inference in Generalized Linear Mixed Models. Journal of the American Statistical Association, 88, 9–25. doi:10.1080/01621459.1993.10594284.
Geyer, C. J., Ridley, C. E., Latta, R. G., Etterson, J. R., and Shaw, R. G. (2012) Aster Models with Random Effects via Penalized Likelihood. Technical Report 692, School of Statistics, University of Minnesota. http://purl.umn.edu/135870.
Geyer, C. J., Ridley, C. E., Latta, R. G., Etterson, J. R., and Shaw, R. G. (2013) Local Adaptation and Genetic Effects on Fitness: Calculations for Exponential Family Models with Random Effects. Annals of Applied Statistics, 7, 1778–1795. doi:10.1214/13-AOAS653.
Examples
library(aster)
data(radish)
pred <- c(0,1,2)
fam <- c(1,3,2)
rout <- reaster(resp ~ varb + fit : (Site * Region),
list(block = ~ 0 + fit : Block, pop = ~ 0 + fit : Pop),
pred, fam, varb, id, root, data = radish)
summary(rout)
summary(rout, stand = FALSE, random = TRUE)