The package RandomFields
offers various tools for
model estimation (ML) and inference (tests) for regionalized variables and data analysis,
simulation of different kinds of random fields, including
multivariate, spatial, spatiotemporal, and nonstationary Gaussian random fields,
Poisson fields, binary fields, Chi2 fields, t fields and
maxstable fields.
It can also deal with nonstationarity and anisotropy of these processes and conditional simulation (for Gaussian random fields, currently).
See http://ms.math.unimannheim.de/de/publications/software/ for intermediate updates.
The following features are provided by the package:
Bayesian Modelling
See Bayesian Modelling for an introduction to hierarchical modelling
Coordinate systems
Cartesian, earth and spherical coordinates are recognized, see coordinate systems for details.
a list of valid models is given by spherical models.
Data and example studies: Some data sets and published code are provided to illustrate the syntax and structure of the package functions.
soil
: soil physical data
weather
: UWME weather data
papers
: code used in the papers published by
the author(s)
Estimation of parameters (for secondorder random fields)
RFfit
: general function for estimating
parameters; (for Gaussian random fields)
RFhurst
: estimation of the Hurst parameter
RFfractaldim
: estimation of the fractal
dimension
RFempiricalvariogram
: calculates
the empirical variogram
Graphics
Fitting a covariance function manually
RFgui
the generic function plot
global graphical parameters with RFpar
Inference (for Gaussian random fields)
RFcrossvalidate
: cross validation
RFlikelihood
: likelihood
RFratiotest
: likelihood ratio test
AIC
,
AICc
,
BIC
, anova
,
logLik
Models
For an introduction an general properties, see RMmodels.
For an overview over classes of covariance and variogram models –e.g. for geostatistical purposes– see RM. More sophisticated models and covariance function operators are included.
To apply the offered package procedures to mixed models
– e.g. appearing in genetical data analysis– see
RFformula
.
definite models are evaluated by RFcov
,
RFvariogram
and RFcovmatrix
.
For a quick impression use plot(model)
.
nondefinte models are evaluated by RFfctn
and
RFcalc
RFlinearpart
returns the linear part of a
model
RFboxcox
deals explicitely with BoxCox
transformations. In many cases it is performed implicitely.
Prediction (for secondorder random fields)
RFinterpolate
: kriging, including imputing
Simulation
RFsimulate
: Simulation
of random fields,
including conditional simulation. For a list of all covariance
functions and variogram models see RM
.
Use plot
for visualisation of the result.
S3 and S4 objects
The functions return S4 objects
based on the package sp,
if spConform=TRUE
.
This is the default.
If spConform=FALSE
,
simple objects as in version 2 are returned.
These simple objects are frequently provided with an S3 class.
This options makes the returning procedure much faster, but
currently does not allow for the comfortable use of
plot
.
plot
,
print
, summary
,
sometimes also str
recognise these S3 and S4
objects
use sp2RF
for an explicite transformation
of sp objects to S4 objects of RandomFields.
Further generic functions are available for fitted models, see ‘Inference’ above.
Xtended features, especially for package programmers
might decide on a large variety of arguments of the
simulation and estimation procedures using the function
RFoptions
may use ‘./configure –withtclconfig=/usr/lib/tcl8.5/tclConfig.sh –withtkconfig=/usr/lib/tk8.5/tkConfig.sh’ to configure R
A list of major changings from Version 2 to Version 3 can be found in MajorRevisions.
Changings lists some further changings, in particular of argument and argument names.
Current updates are available through http://ms.math.unimannheim.de/de/publications/software.
Contributions to version 3.0 and following:
Felix Ballani (TU Bergakademie Freiberg; Poisson Polygons, 2014)
Daphne Boecker (Univ. Goettingen; RFgui, 2011)
Katharina Burmeister (Univ. Goettingen; testing, 2012)
Sebastian Engelke (Univ. Goettingen; RFempiricalvariogram, 201112)
Sebastian Gross (Univ. Goettingen; tilde formulae, 2011)
Alexander Malinowski (Univ. Mannheim; S3, S4 classes 201113)
Juliane Manitz (Univ. Goettingen; testing, 2012)
Johannes Martini (Univ. Goettingen; RFempiricalvariogram,
201112)
Ulrike Ober (Univ. Goettingen; help pages, testing, 201112)
Marco Oesting (Univ. Mannheim; BrownResnick processes, Kriging, Trend,
201113)
Paulo Ribeiro (Unversidade Federal do Parana; code adopted
from geoR, 2014)
Kirstin Strokorb (Univ. Mannheim; help pages, 201113)
Contributions to version 2.0 and following:
Peter Menck (Univ. Goettingen; multivariate circulant embedding)
R Core Team, Richard Singleton (fft.c and advice)
Contributions to version 1 and following:
Ben Pfaff, 12167 Airport Rd, DeWitt MI 48820, USA making available
an algorithm for AVL trees (avltr*)
Patrick Brown : comments on Version 3
Paulo Riberio : comments on Version 1
Martin Maechler : advice for Version 1
V3.0 has been financially supported by the German Science Foundation (DFG) through the Research Training Group 1953 ‘Statistical Modeling of Complex Systems and Processes — Advanced Nonparametric Approaches’ (20132018).
V3.0 has been financially supported by Volkswagen Stiftung within the project ‘WEXMOP’ (20112014).
Alpha versions for V3.0 have been financially supported by the German Science Foundation (DFG) through the Research Training Groups 1644 ‘Scaling problems in Statistics’ and 1023 ‘Identification in Mathematical Models’ (200813).
V1.0 has been financially supported by the German Federal Ministry of Research and Technology (BMFT) grant PT BEO 510339476C during 200003.
V1.0 has been financially supported by the EU TMR network ERBFMRXCT960095 on “Computational and statistical methods for the analysis of spatial data” in 1999.
The following packages enable further choices for the optimizer
(instead of optim
) in RandomFields:
optimx, soma, GenSA, minqa, pso,
DEoptim, nloptr, RColorBrewer, colorspace
Martin Schlather, schlather@math.unimannheim.de http://ms.math.unimannheim.de/de/publications/software
Singleton, R.C. (1979). In Programs for Digital Signal Processing Ed.: Digital Signal Processing Committee and IEEE Acoustics, Speech, and Signal Processing Committe (1979) IEEE press.
Schlather, M., Malinowski, A., Menck, P.J., Oesting, M. and Strokorb, K. (2015) Analysis, simulation and prediction of multivariate random fields with package RandomFields. Journal of Statistical Software, 63 (8), 125, url = ‘http://www.jstatsoft.org/v63/i08/’
see also the corresponding vignette.
See also RF, RM, RP, RR, RC, R.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23  RFoptions(seed=0) ## *ANY* simulation will have the random seed 0; set
## RFoptions(seed=NA) to make them all random again
# simulate some data first (Gaussian random field with exponential
# covariance; 6 realisations)
model < RMexp()
x < seq(0, 10, 0.1)
z < RFsimulate(model, x, x, n=6)
## select some data from the simulated data
xy < coordinates(z)
pts < sample(nrow(xy), min(100, nrow(xy) / 2))
data < matrix(nrow=nrow(xy), as.vector(z))[pts, ]
data < cbind(xy[pts, ], data)
plot(z, data)
## reestimate the parameter (true values are 1)
estmodel < RMexp(var=NA, scale=NA)
(fit < RFfit(estmodel, data=data))
## show a kriged field based on the estimated parameters
kriged < RFinterpolate(fit, x, x, data=data)
plot(kriged, data)

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.
All documentation is copyright its authors; we didn't write any of that.