RMtrend {RandomFields}R Documentation

Trend Model

Description

RMtrend is a pure trend model with covariance 0.

Usage

RMtrend(mean, plane, polydeg, polycoeff, arbitraryfct, fctcoeff)

Arguments

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 mean is interpreted as constant mean of Z_i(.).

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 polydeg; the coefficients are either assumed to be unknown or to be given by polycoeff.

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 polydeg_1, ..., polydeg_p in a d-dimensional space. Each component of polycoeff gives the coefficient to one basis function; these products are added providing p trend polynomials.
For the order of the monomial basis functions see details. CAUTION: This argument should be used by advanced users only as the order might be sophisticated. In many cases it is recommended to use arbitraryfct and fctcoeff instead.

arbitraryfct

optional; should be a p-variate function; the i-th component of arbitraryfct describes the trend surface of Z_i(.); the arguments of this function should be location (and time) corresponding to the random field to be modelled. If RMtrend is used in the model definition of the functions RFsimulate, RFfit or RFinterpolate, the names of the arguments should be given by x, y, z, T.

fctcoeff

optional; should be numerical; determines the coefficient belonging to arbitraryfct, i.e. the trend is given by fctcoeff * arbitraryfct. Note that the coefficient is the same for each component of arbitraryfct; fctcoeff is ignored if arbitraryfct=NULL.

Details

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.

Value

RMtrend returns an object of class RMmodel.

Note

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.

Author(s)

Marco Oesting, oesting@math.uni-mannheim.de

Martin Schlather, schlather@math.uni-mannheim.de http://ms.math.uni-mannheim.de/de/publications/software

References

Chiles, J. P., Delfiner, P. (1999) Geostatistics: Modelling Spatial Uncertainty. New York: John Wiley & Sons.

See Also

RMmodel, RFformula, RFsimulate, RMplus

Examples

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!









[Package RandomFields version 3.0.62 Index]