spaMM reference page
spaMM is a standard R package distributed on CRAN (latest version: 3.0.0, 2019/06/21). 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 introduction (latest version 2019/06/21) to the package. See the NEWS for all recent changes.
- Fitting geostatistical models with
random-effect terms following the Matern
as well as the much less known Cauchy
correlation models, or autoregressive models
described by an adjacency matrix or AR1 model, or an arbitrary given precision or
correlation matrix (corrMatrix). Version 2.7.0 added the possibility to fit
conditional spatial effects (as in say Matern(female|...)+Matern(male|...) to fit
distinct random effects for females and males).
- A further class of spatial correlation
models, "Interpolated Markov Random Fields" (IMRF)
covers widely publicized approximations of Matérn models
et al. 2011) and the multiresolution model of Nychka
et al. 2015.
- A growing list of response families is handled, including zero-truncated variants of the Poisson and negative binomial, and Conway-Maxwell-Poisson (COMPoisson) family;
- A replacement function for glm, useful when the latter (or even glm2) fails to fit a model;
- A syntax close to that of glm or [g]lmer. It includes a growing list of extractor methods similar to 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;
- Simple facilities for quickly drawing maps from model fits (as shown on this page), using only base graphic functions. See here for more elaborate examples of producing maps;
- (Somewhat experimental) 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 (e.g., Beta- or Gamma-distributed), structured dispersion models (including residual dispersion models with random effects), and implementation of several variants of Laplace and PQL approximations. But it often 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 has distinct algorithms for three cases: sparse precision, sparse correlation, and dense correlation matrices, and is efficient to fit geostatistical, autoregressive, and other mixed models on large data sets. Notable 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.
Past and current contributors: François Rousset (maintainer), Jean-Baptiste Ferdy, and Alexandre Courtiol.
Funding: spaMM development benefitted
from a PEPS grant from CNRS and University of Montpellier
and has been 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