Fits Aster Models with Random Effects using Laplace Approximation.
reaster(fixed, random, pred, fam, varvar, idvar, root,
famlist = fam.default(), origin, data, effects, sigma, response)
reaster
returns an object of class inheriting from "reaster"
.
An object of class "reaster"
is a list containing at least the
following components:
The aster object returned by a call to the aster
function to fit the fixed effects model.
the model matrix for fixed effects.
the model matrix or matrices for random effects.
names of columns dropped from the fixed effects matrix.
approximate MLE for square roots of variance components.
approximate MLE for variance components.
penalized likelihood estimates for the \(c\)'s, which are rescaled random effects.
penalized likelihood estimates for the random effects.
approximate MLE for fixed effects.
\(Z W Z^T\) where \(Z\) is the model matrix for random effects and \(W\) is the Hessian matrix of minus the complete data log likelihood with respect to random effects with MLE values of the parameters plugged in.
the response vector.
the origin (offset) vector.
number of iterations of trust region algorithm in
each iteration of re-estimating zwz
and re-fitting.
number of iterations of Nelder-Mead in initial optimization of approximate missing data log likelihood.
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 aster
function.)
Calls to reaster.formula
return a list also containing:
the matched call.
the formulas supplied.
either a model matrix or a formula specifying response and model matrix. The model matrix for fixed effects.
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.
an integer vector of length nnode
determining
the dependence graph of the aster model. pred[j]
is
the index of the predecessor of
the node with index j
unless the predecessor is a root
node, in which case pred[j] == 0
. See details section
of aster
for further requirements.
an integer vector of length nnode
determining
the exponential family structure of the aster model. Each element
is an index into the vector of family specifications given by
the argument famlist
.
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 nnode
.
Must be of the form rep(vars, each = nind)
where vars
is
a vector of variable names. Usually found in the data frame data
when this is produced by the reshape
function.
a variable whose length is the row dimension of all model
matrices. The number of individuals is nind
.
Must be of the form rep(inds, times = nnode)
where inds
is
a vector of labels for individuals. Usually found in the data frame
data
when this is produced by the reshape
function.
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.
a list of family specifications (see families
).
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
aster
for further explanation.
an optional data frame containing the variables
in the model. If not found in data
, the variables are taken
from environment(fixed)
, typically the environment from
which reaster
is called. Usually produced by
the reshape
function. Not needed when model matrices
rather than formulas are supplied in fixed
and random
.
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 c
of the output of this function).
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 random
if a list and one
if random
is not a list.
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 fixed
.
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”.
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.
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.
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.
Breslow, N. E., and Clayton, D. G. (1993). Approximate Inference in Generalized Linear Mixed Models. Journal of the American Statistical Association, 88, 9--25. tools:::Rd_expr_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. tools:::Rd_expr_doi("10.1214/13-AOAS653").
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)
Run the code above in your browser using DataLab