spaMM reference page
spaMM is a standard R package distributed on CRAN
(latest version: 2.2.0, 2017/10/03). It was originally designed for fitting spatial
generalized linear mixed models (GLMMs),
particularly the so-called geostatistical model allowing
prediction in continuous space. But it is now a more
general-purpose package for fitting mixed models, spatial
or not. You can download here a gentle
version May 26, 2017) to the package.
See the NEWS
for all recent changes.
- Genetic, phylogenetic, or other given correlations are easily taken into account using the corrMatrix argument of the HLCor function;
- It fits the Beta binomial model, negative binomial response family, and Conway-Maxwell-Poisson (COMPoisson) response family;
- It includes a replacement function for glm, useful when the latter (or even glm2) fails to fit a model;
- Its syntax is close to that of glm or [g]lmer. It includes a growing list of extractor methods derived from those in stats or nlme/lmer, and functions for inference beyond the fits, such as confint for confidence intervals of fixed-effect parameters, and predict including computation of prediction variances;
- It includes simple facilities for quickly drawing maps from model fits (as shown on this page). See here for more elaborate examples of producing maps;
- It includes facilities for handling multinomial data.
This page could provide updates not yet on
CRAN (see installation notes below if you download such an update) but this is not the case presently.
Initial stimulus for spaMM development came from work by Lee and Nelder on h-likelihood (e.g. Lee, Nelder & Pawitan, 2006; Lee & Lee 2012; see also Molas and Lesaffre, 2010), and it retains from that work several distinctive features, such as the ability to fit models with non-gaussian random effects, structured dispersion models (including residual dispersion models with random effects), and implementation of several variants on Laplace and PQL approximations. But it increasingly relies on alternatives to the iterative algorithms considered by Lee and Nelder to jointly fit all model parameters, and on alternative implementations of the most expensive matrix computations. spaMM now has distinct algorithms for three cases: sparse precision, sparse correlation, and dense correlation matrices, which make it competitive to fit geostatistical, autoregressive, and other mixed models on large data sets (although simple cases, including LMMs, are not yet fully optimized). Additional features include:
Rousset F., Ferdy J.-B. (2014) Testing environmental and genetic effects in the presence of spatial autocorrelation. Ecography, 37: 781-790.
Also available here is the Supplementary Appendix G from that paper, including comparisons with a trick commonly, but uncritically, used to constrain the functions lmer and glmmPQL to analyse spatial models.
Planned extensions of spaMM include the use of stochastic algorithms for estimation of likelihood in binary probit models, further inmprovements in speed, further implementation of autoregressive models, and alternative procedures to fit models with random-coefficient terms.
Funding: spaMM development benefitted
from a PEPS grant from CNRS and University of Montpellier
and is currently hosted within the IBC.
Installing versions obtained from this page:Installation is exactly as for any other local tar.gz package archive, but details of this general procedure are often ignored.
Run install.packages with the highlighted options:
> install.packages(<archive name>,type="source",repos=NULL)
If this fails and you are a Windows user, then it is likely that you have not (fully) installed the Rtools. If you think you have installed the Rtools but this fails, then you probably have not set the PATH variable in the Windows environment variables (cf "Edit the path variable" here). To check that you have fully installed the Rtools, make a test by installing another package that requires compilation, e.g. lpSolveAPI, from its archive by using type="source".
This page (C) F. Rousset 2013-present