This task view aims at presenting the useful R packages for the analysis
of spatio-temporal data.
Please let the
maintainer
know if
something is inaccurate or missing.
The following people contributed to this task view: Roger Bivand, Achim
Zeileis, Michael Sumner, Ping Yang.
Although one could argue that all data are spatio-temporal, as they
must have been taken somewhere and at some point in time, in
many cases the spatial locations or times of observation are not
registered, and irrelevant to the purpose of the study. Here,
we will address the cases where both location
and
time
of observation are registered, and relevant for the analysis of
the data. The
Spatial
and
TimeSeries
task views shed light on spatial, and temporal data handling and
analysis, individually.
Representing data
-
In long tables:
In some cases, spatio-temporal data can be held in tables
(
data.frame
objects), with longitude, latitude and
time as three of the columns, or an identifier for a location
or region and time as columns. For instance, data sets in
package
plm
for linear panel models have repeated
observations for observational units, where these units often
refer to spatial areas (countries, states) by an index. This index
(a name, or number) can be matched to the spatial coordinates
(polygons) of the corresponding area, an example of this is given
by
Pebesma (2012, Journal of Statistical Software)
. As these
data sets usually contain more than one attribute, to hold the
data in a two-dimensional table a
long table
form is
chosen, where each record contains the index of the observational
unit, observation time, and all attributes.
-
In time-wide tables:
When a single attribute is considered, another layout is that
of the
time-wide table
, where each observational
unit forms a record and each column an observation time.
googleVis
lets you analyze such data in a way similar to
gapminder (see links).
-
In space-wide tables:
An acample of a space-wide table is the Irish wind data set,
obtained by
data(wind)
in package
gstat.
It has time series as different columns, each column representing
one location (weather station). The
stConstruct
function in package
spacetime
accepts data in long,
time-wide or space-wide tables.
-
Generic classes:
Formal classes for spatio-temporal data in R are provided by
the
spacetime
package, which offers S4 classes for
full space-time grids (every observational unit contains an
observation for each observation time), sparse space-time grids
(regular, but incomplete grids), irregular space-time data
(each observational unit is observed at its own time), and
has limited support for trajectory data.
spacetime
classes have
sp
and
xts
objects as slots
for the spatial and temporal components, and can deal with all
spatial classes (points, lines, polygons, grids) of
sp,
regular and irregular time series, and extend the powerful methods
(selection, aggregation, plotting coercion) from both packages.
-
Dedicated classes:
dedicated classes are offered for:
-
Geostatistical data:
Package
SpatioTemporal
offers an S3 class
STdata
which holds point observations and covariates
that can vary in space, time, and space-time, with the aim of
fitting and predicting a particular class of spatio-temporal models,
described in its vignettes.
-
Gridded/raster data:
package
raster
deals with
sets of rasters (called bricks, or stacks), and a
set may reflect a temporal sequence
(use
setZ
on a brick or stack).
-
Lattice data:
package
surveillance
provides a class
sts, which holds a
SpatialPolygonsDataFrame
slot for the areas, and
numeric slots to define a regular time series (no time objects,
such as
POSIXct).
-
Point patterns:
package
stpp
provides a class
stpp
for a space-time point pattern.
package
stppResid
provides a class
stwin
for a space-time cuboid, defining a (rectangular)
space-time window, and class
stpp
for a
spatio-temporal point pattern (including window).
Package
spatstat
provides a class
ppx
that
deals spatial and temporal coordinate.
None of the point pattern classes mentioned support spatial or
explicit temporal reference systems.
-
Trajectory data:
Package
adehabitatLT
offers a class
ltraj
for trajectories, and methods for analyzing them; package
trip
extends
sp
based classes for trajectories.
Analyzing data
-
Geostatistical data
-
gstat
provides kriging, methods of moments
variogram estimation and model fitting for a limited
range of spatio-temporal models.
-
RandomFields
provides kriging, conditional simulation,
and covariance functions and maximum likelihood function fitting
for a very wide range of spatio-temporal covariance models.
-
the
spTimer
package is able to fit,
spatially predict and temporally forecast large amounts
of space-time data using Bayesian Gaussian Process
(GP) Models, Bayesian Auto-Regressive (AR) Models,
and Bayesian Gaussian Predictive Processes (GPP)
based AR Models.
-
Package
SpatioTemporal
fits and predicts
a particular class of spatio-temporal models, described
in detail in its vignettes.
-
spBayes
provides functions for fitting Bayesian dynamic
space-time regression models for settings where space
is viewed as continuous but time is taken to be discrete.
-
Stem
provides estimation of the parameters
of a spatio-temporal model using the EM algorithm,
estimation of the parameter standard errors using a
spatio-temporal parametric bootstrap, spatial mapping.
-
spate
provides spatio-temporal modeling
of large data using a spectral SPDE approach.
-
pastecs
is a package for the regulation, decomposition
and analysis of space-time series.
-
R-Forge package
spcopula
provides a framework to analyze via copulas spatial
and spatio-temporal data provided in the format of the
spacetime package. Additionally, support for calculating
different multivariate return periods is implemented.
-
solaR
is a package for computing solar radiation and photovoltaic
systems performance.
-
nlme
and
lme4
contain functions
to fit linear mixed models, and have facilities to model
spatial and/or temporal effects.
-
Point patterns
-
splancs
provides methods for spatial and
space-time point pattern analysis (khat, kernel3d,
visualizing).
-
lgcp
is a package for spatial and spatio-temporal modelling of point patterns using the log-Gaussian Cox process.
-
stpp
allows Space-Time Point Pattern simulation, visualization and analysis.
-
stppResid
performs residual analysis on space-time point process models.
-
stam
is an evolving package that target on
the various methods to conduct Spatio-Temporal Analysis and
Modelling,including Exploratory Spatio-Temporal Analysis
and Inferred Spatio-Temporal Modelling, currently provides
mostly kernel density estimation.
-
ptproc
(off-CRAN) provides methods and classes for spatio-temporal
("multi-dimensional") point process.
-
Lattice data
-
surveillance
provides temporal and spatio-temporal
modeling and monitoring of epidemic phenomena.
-
plm
fits linear panel models.
-
splm
provides estimation and diagnostic
testing of econometric models for spatial panel data.
-
sphet
fit spatial models with heteroskedastic
innovations.
-
nlme
and
lme4
contain functions
to fit linear mixed models, and have facilities to model
spatial and/or temporal effects.
-
Moving objects, trajectories
-
adehabitatLT
provids a collection of tools
for the analysis of animal movements, including biased random walk
simulation and home range estimation.
-
package
trip
provides functions for accessing
and manipulating spatial data for animal tracking. Filter
for speed and create time spent plots from animal track
data.
-
tripEstimation
provides a Metropolis
sampler and supporting functions for estimating animal
movement from archival tags and satellite fixes.
It further provides data handling and estimation functions
for animal movement estimation from archival or satellite
tags. Helper functions are included for making image
summaries binned by time interval from MCMC simulations
of point data.
-
diveMove
provides utilities to represent,
visualize, filter, analyze, and summarize time-depth
recorder (TDR) data; miscellaneous functions for handling
location data are also provided.
-
argosfilter
provides functions to filters
animal satellite tracking data obtained from Argos. It is
especially indicated for telemetry studies of marine
animals, where Argos locations are predominantly of
low-quality.
-
GeoLight
provides basic functions for global positioning
based on light intensity measurements over time. Positioning process
includes the determination of sun events, a discrimination of
residency and movement periods, the calibration of period-specific
data and, finally, the calculation of positions.
-
crawl (
ARCHIVED
):
The (C)orrelated (RA)ndom (W)alk (L)ibrary of R functions
was designed for fitting continuous-time correlated random
walk (CTCRW) models with time indexed covariates. The
model is fit using the Kalman-Filter on a state space
version of the continuous-time stochastic movement process.
-
The
Electronic Tagging Geolocation Packages Repository
site provides a collection of statistical models (and R packages)
to estimate position errors, movement model parameters,
and most probable positions from tracking data.
-
move
is a package for analyzing animal
movement data; it contains functions to access movement data
stored in
movebank
as well as tools to visualize and statistically analyse
animal movement data.
-
bsam
fits Bayesian state-space models to Argos satellite tracking
data. Currently, models provided are DCRW (for location filtering),
DCRWS (for location filtering and behavioural state estimation), and
hDCRWS (a hierarchical model for location filtering and behavioural
state estimation across multiple animals).
Visualization
-
rasterVis
includes a variety of methods
that take advantage of the
z
slot of a
RasterStack
or
RasterBrick
object. Its
webpage
includes several examples, from the hovmoller plot and
horizon graph, to the density and histogram plots.
-
package
plotKML
provides methods to convert
spatio-temporal data into KML files, which can be displayed
by external viewers, in particular Google Earth. It has a
gallery
too.
-
package
googleVis
provides an interface to show R data
(tables) in the
Google Chart Tools
.
-
package
stpp
and
splancs
provide
animation and 3D interactive plots (using
rgl)
for displaying spatio-temporal point patterns.
-
mvtsplot
provides multivariate time series plots,
with examples on spatio-temporal data, published by
Peng (2008, Journal of Statistical Software)
.
Data sets
-
Table data for fitting linear panel models are found in
plm.
-
Package
cshapes
contains a data base with country boundaries,
varying over time.
-
gstat
contains the classic Irish wind data.
-
spacetime
contains rural PM10 air quality
measurements over Germany.
-
Some parts of the Cressie and Wikle (2011) book "Statistics for spatio-temporal
data" can be reproduced by
demo(CressieWikle)
in
spacetime.
Retrieving data
Packages for retrieving data are:
-
Package
openair
has tools to analyze, interpret and understand air pollution data, but also tools to download UK air quality data.
-
ncdf,
ncdf4
and
RNetCDF
allow reading and writing
netcdf
files;
pbdNCDF4
adds collective parallel read and write capability
to
ncdf4.
-
RghcnV3
provides (access to) global historical climate
network (V3) data
-
M3
contains functions to read in and manipulate air
quality model output from Models3-formatted files. This format
is used by the Community Multiscale Air Quaility (CMAQ) model.