| RMtrend {RandomFields} | R Documentation |
RMtrend is a pure trend model with covariance 0.
RMtrend(mean, plane, polydeg, polycoeff, arbitraryfct, fctcoeff)
mean |
optional; should be a vector of length p, where
p is the number of variables taken into account by the
corresponding multivariate random field
(Z_1(.),…,Z_p(.));
the i-th component of |
plane |
optional; should be a d x p-matrix where d is the dimension of the random field and p the number of variables considered; corresponds to a trend described by p hyperplanes. The mean of Z_i(x) with x= (x_1,…,x_d) is given by plane_{1i} x_1 + plane_{2i} x_2 + … + plane_{di} x_d. |
polydeg |
optional; should be an integer vector of length p;
indicates that the mean of Z_i(.) is given by a
multivariate polynomial of degree less than or equal to the
i-th component of |
polycoeff |
optional; should be a vector of length {polydeg_1+d\choose d} + … + {polydeg_p+d\choose d} which is the number of monomial basis functions up to degree
|
arbitraryfct |
optional; should be a p-variate
function; the i-th component of |
fctcoeff |
optional; should be numerical; determines the
coefficient belonging to |
If different trend arguments are given, the corresponding trend
components are added. Equivalently, + (see
RFformula) or RMplus can be used
to add trend terms.
Note that this function refers to trend surfaces in the geostatistical
framework. Fixed effects in the mixed models framework are
implemented, as well (see RFformula).
The order of the monomial basis functions and the corresponding
coefficients given by polycoeff is the following:
The first {polydeg_1+d\choose d} components belong to the
trend polynomial of the first variable, the following
{polydeg_2+d\choose d} ones to the second one, and so on.
Within one trend polynomial the monomial basis functions are ordered
by the powers in an ascending way such that the power of the first
component varies fastest; e.g. the monomial basis functions up to
degree k in a two-dimensional space are given by
1, x, …, x^k, y, xy, …, x^{k-1}y, y^2, …, x y^{k-1}, y^k.
RMtrend returns an object of class RMmodel.
Using uncapsulated substraction to build up a covariance
function is ambiguous, see the examples below.
Best to define the trend separately, or to use R.minus.
Marco Oesting, oesting@math.uni-mannheim.de
Martin Schlather, schlather@math.uni-mannheim.de http://ms.math.uni-mannheim.de/de/publications/software
Chiles, J. P., Delfiner, P. (1999) Geostatistics: Modelling Spatial Uncertainty. New York: John Wiley & Sons.
RMmodel,
RFformula,
RFsimulate,
RMplus
RFoptions(seed=0) ## *ANY* simulation will have the random seed 0; set ## RFoptions(seed=NA) to make them all random again ################################################## # Example 1: # # Simulate from model with a plane trend surface # ################################################## #trend: 1 + x - y, cov: exponential with variance 0.01 model <- ~ RMtrend(mean=1, plane = c(1,-1)) + RMexp(var=0.04) #equivalent model: model <- ~ RMtrend(polydeg=1,polycoeff=c(1,1,-1)) + RMexp(var=0.4) #Simulation x <- 0:10 simulated0 <- RFsimulate(model=model, x=x, y=x) plot(simulated0) ## NOTE: the future way of modelling the trend will be: trend <- 1 + R.p(1) - R.p(2) model <- RMexp(var=0.4) + trend ## IMPORTANT: avoid substractopm in the trend definition ## or define the trend in a separate definition first trend <- -1 (model0 <- RMexp(var=0.4) + trend) (model1 <- RMexp(var=0.4) + -1)## same as model0 (model2 <- RMexp(var=0.4) - 1) ## different from model0 !! plot(RFsimulate(model=model1, x=x, y=x)) ## random with covariance ## model being the exponential one plot(RFsimulate(model=model2, x=x, y=x)) ## purely deterministic trend!