spaMM reference page

spaMM is a standard R package distributed on  CRAN. It was originally designed for fitting spatial generalized linear mixed models (GLMMs), but is now a more general-purpose package for fitting mixed models, spatial or not

Figures generated by code shown in example(seaMask) and example(mapMM)

  • It deals with several random effects with different distributions, one of which may be a Gaussian spatial effect;
  • Genetic, phylogenetic, or other given correlations are easily taken into account using the corrMatrix argument of the HLCor function;
  • It includes the Beta binomial, negative binomial, or GLMs with structured dispersion as special cases;  
  • The Conway-Maxwell-Poisson (COMPoisson) response family is handled
  • It includes a replacement function for glm, useful when the latter 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
  • It includes facilities for drawing maps (as shown on the right);
  • It includes facilities for handling multinomial data.

Version 1.9.0 was released on CRAN on May 24, 2016. A few features new to the last two versions are highlighted here. The negative binomial response family is more accurately handled than before, as the negbin family, rather than as a Laplace approximation of a Poisson-Gamma mixed model. Further, a new fitting function, fitme(), has been introduced, which can be much (>10 times) faster than other fitting functions in spaMM. See the NEWS for all recent changes. You can download here a gentle introduction (latest version May 24, 2016) to the package. 

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.  

spaMM was designed first to fit spatial models with dense correlation matrices. Substantial computational speed-ups for "autoregressive" models were not first considered, out of a lack of specific interest for such models. However, an efficient implementation of the conditional autoregressive (CAR) model is now available, as a step towards further developments.  

Planned developments for spaMM include the implementation of simultaneous autoregressive (SAR) models, and the use of stochastic algorithms for estimation of likelihood in binary probit models. The currently implemented fitting methods are based on several variants of Laplace aproximations discussed in particular by Lee, Nelder, and collaborators (e.g. Lee, Nelder & Pawitan, 2006; Lee & Lee 2012; see also Molas and Lesaffre, 2010). The performance of these methods for spatial GLMMs was assessed in :
    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 used to constrain the functions lmer and glmmPQL to analyse spatial models.

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 with the archive of another package that requires compilation, e.g. on the downloaded archive of the lpSolveAPI package.

Funding: spaMM development benefitted from a PEPS grant from CNRS and universities Montpellier 1 & 2 and is currently hosted within the IBC.

spaMM (C) François Rousset (CNRS & University Montpellier 2) & Jean-Baptiste Ferdy (University of Toulouse) 2013-present.
Additional contributor: Alexandre Courtiol (IZW Berlin).
This page (C) F. Rousset 2013-present

Main web page