lme4ord: 'lme4ord': Generalized Linear Mixed Models with Flexible...

Description Motivation Modularization

Description

lme4ord: Generalized Linear Mixed Models with Flexible (Co)Variance Structures

Motivation

The lme4ord package was written to solve applied problems in biology and ecology, but should be more general than that. The original goal of lme4ord is to provide a flexible platform and API, for using the computational machinery from the lme4 package to fit generalized linear mixed models to ecological community data. Models for community data typically require more flexibility than the standard lme4 interface can provide, despite the fact that lme4 can usually be hacked to fit such models. lme4ord was developed to avoid such hacking by providing infrastructure for specifying a wide range of models. For example, lme4ord is able to fit the following types of models:

Despite this origin in community ecology, lme4ord is more broadly useful for fitting a very wide variety of structured generlized linear mixed models.

Modularization

The design of lme4ord is intended to facilitate use by people with a range of skill levels and interests. In order to achieve this goal, lme4ord is composed of several modules (illustrated in the figure below). Those who choose to interact with all modules will benefit from maximum flexibility, whereas more simple uses may require only a few modules.

modularizationDiagram.png

Arrows point from modules that make use of functions from the module to which they point.

structured glmm

The model fitting module consists of a single function, strucGlmer. This function calls the next four modules in the order given.

formula parsing

The formula parsing module takes a mixed model formula and data, and returns a set of objects required to fit the specified model. This module may be accessed directly via the strucParseFormula function. In addition to standard lme4-style random effects terms, mixed model formulas may consist of special reTrmStruct object constructed using the random-effects structures module described below. The findReTrmClasses function may be used to list all such special structures that are available. Also see: splitForm; simulate.strucParseFormula.

deviance function construction

This module is what links a strucParseFormula object with the underlying C++ machinery of lme4. The function mkGeneralGlmerDevfun may be used to construct a function that uses C++ code to compute the deviance (minus twice the log-likelihood) for a given set of parameters. Also see mkPenaltyFun.

optimization

Currently lme4ord uses the bobyqa function in the minqa package to optimize deviance functions.

output

There are a variety of methods and extractor functions for exploring fitted models of strucGlmer-class. These objects are constructed by strucGlmer, which calls mkStrucGlmer. There are many methods for strucGlmer-class objects including print.strucGlmer; summary; pars.strucGlmer; fixef.strucGlmer; covar.strucGlmer; loads.strucGlmer; ranef.strucGlmer; nobs.strucGlmer; residuals.strucGlmer; fitted.strucGlmer; vcov.strucGlmer; VarCorr.strucGlmer; isREML.strucGlmer; df.residual.strucGlmer; deviance.strucGlmer; logLik.strucGlmer; formula.strucGlmer; family.strucGlmer; weights.strucGlmer; model.matrix.strucGlmer; simulate.strucGlmer. Also see: getStrucGlmerPar; parPerTerm; covarPerTerm; loadsPerTerm; nRePerTrm; reIndsPerTrm; getOffset; simStrucParsedForm; printReTrm; getReTrm; compressStrucGlmer.

random-effects structures

One may specify new special random effects structures by defining new methods for the setReTrm generic. To get started constructing such methods see showSkeleton("setReTrm"). The findReTrmClasses function may be used to list all methods that are currently available. Also see: mkReTrmStructs; getModMatAndGrpFac; packReTrm; update.reTrmStruct; setLowerDefault; simReTrm; mkSparseTrans.

Structured sparse matrices

Many contemporary mixed models and latent variable models involve large matrices, which at each iteration of an optimization algorithm need to (1) have their values updated and (2) be involved in matrix algebra. Fortunately these large matrices have structure that can be exploited for developing better fitting algorithms. The first type of structure is that these matrices are constructed by applying a small number of simple operations on relatively small building-block matrices. This basis in build-block matrices makes it simpler to update mixed model matrices. The second type of structure is that these mixed model matrices are often sparse, in that they contain a relatively large number of zeros. This sparsity allows for more efficient matrix operations involved in the fitting proceedure. There is quite alot of machinery in the Matrix package for exploiting sparsity. There is less machinery for exploiting the building-block structure of mixed-model matrices. The strucMatrix objects in the lme4ord package provide such machinery.

utilities

A utility is a function that does _not_ make use of functions from any other module. The purpose of separating utilities in this way is to preserve modularity. Currently, the list of utilities is: mkParInds; getInit; getInit; factors, stanCov; nChoose2Inv; familySimFun; triInds; countUnique; flattenIntVec; assignWith; showSkeleton; listTranspose; denseDiagInds; edgeTipIndicator; covExpDecay; orthProcrustesRotMat.


stevencarlislewalker/lme4ord documentation built on May 30, 2019, 4:43 p.m.