RFformula {RandomFields}R Documentation

RFformula - syntax to design random field models with trend or linear mixed models

Description

It is described how to create a formula, which can e.g. be used as an argument of RFsimulate and RFfit to simulate and to fit data accordingly to the model described by the formula.

In general, the created formula serves two purposes:

Thereby, fixed effects and trend surfaces are adressed via the expression RMfixed and the function RMtrend; the covariance structures of the zero-mean multivariate normally distributed random effects and random field components are adressed by objects of class RMmodel, which allow for a very flexible covariance specification.

Details

The formula should be of the type

response ~ fixed effects + random effects + error term

or

response ~ trend + zero-mean random field + nugget effect,

respectively.

Thereby:

IMPORTANT

Note that in formula constants are interpreted as part of a mixed model, i.e. the corresponding parameter has to be estimated (e.g. ~ 1 + ...) whereas models not given as formula the parameters to be estimated must be given explicitely.

Note

(additional) argument names should always start with a capital letter. Small initial letters are reserved for RFoptions.

Author(s)

Martin Schlather, schlather@math.uni-mannheim.de

References

See Also

RMmodel, RFsimulate, RFfit, RandomFields.

Examples

RFoptions(seed=0) ## *ANY* simulation will have the random seed 0; set
##                   RFoptions(seed=NA) to make them all random again

RFoptions(modus_operandi="sloppy")

##############################################################
#
# Example  : Simulation and fitting of a two-dimensional
# Gaussian random field with exponential covariance function
#
###############################################################

V <- 10
S <- 0.3
M <- 3
model <- RMexp(var=V, scale=S) + M
x <- y <- seq(1, 3, 0.1)

simulated <- RFsimulate(model = model, x=x, y=y)
plot(simulated)


# an alternative code to the above code:
simulated2 <- RFsimulate(model = ~ 1@RMfixed(beta=M) +
               RMexp(var=V, scale=S),x=x, y=y, V=V, S=S, M=M)
plot(simulated2)

# Estimate parameters of underlying covariance function via
# maximum likelihood
model.na <- ~ 1@RMfixed(beta=NA) + RMexp(var=NA, scale=NA)
fitted <- RFfit(model=model.na, data=simulated)

# compare sample mean of data with ML estimate:
mean(simulated@data[,1]) 
fitted

















[Package RandomFields version 3.1.50 Index]