Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

RFcrossvalidate

Fitting model parameters to spatial data (regionalised variables) and to linear (mixed) models


Description

The function estimates arbitrary parameters of a random field specification with various methods. Currently, the models to be fitted can be

The fitting of max-stable random fields and others has not been implemented yet.

Usage

RFcrossvalidate(model, x, y=NULL, z=NULL, T=NULL, grid=NULL, data,
                params, lower=NULL, upper=NULL, method="ml",
                users.guess=NULL, distances=NULL, dim, optim.control=NULL,
                transform=NULL, full = FALSE, ...)

Arguments

model,params

object of class RMmodel, RFformula or formula; best is to consider the examples below, first.
The argument params is a list that specifies free parameters in a formula description, see RMformula.

x

vector of x coordinates, or object of class GridTopology or raster; for more options see RFsimulateAdvanced.

y,z

optional vectors of y (z) coordinates, which should not be given if x is a matrix.

T

optional vector of time coordinates, T must always be an equidistant vector. Instead of T=seq(from=From, by=By, len=Len), one may also write T=c(From, By, Len).

grid

logical; the function finds itself the correct value in nearly all cases, so that usually grid need not be given. See also RFsimulateAdvanced.

data

matrix, data.frame or object of class RFsp;
If a matrix is given the ordering of the colums is the following: space, time, multivariate, repetitions, i.e. the index for the space runs the fastest and that for repetitions the slowest.

lower

list or vector. Lower bounds for the parameters. If lower is a vector, lower has to be a vector as well and its length must equal the number of parameters to be estimated. The order of lower has to be maintained. A component being NA means that no manual lower bound for the corresponding parameter is set.
If lower is a list, lower has to be of (exactly) the same structure of the model.

upper

list or vector. Upper bounds for the parameters. See lower.

method

Single method to be used for estimating, either one of the methods or one of the sub.methods see RFfit

users.guess

User's guess of the parameters. All the parameters must be given using the same rules as for lower (except that no NA's should be contained).

distances,dim

another alternative for the argument x to pass the (relative) coordinates, see RFsimulateAdvanced.

optim.control

control list for optim, which uses ‘L-BFGS-B’. However parscale may not be given.

transform

obsolete for users; use param instead. transform=list() will return structural information to set up the correct function.

full

logical. If TRUE then cross-validation is also performed for intermediate models used in RFfit (if any).

...

for advanced use: further options and control arguments for the simulation that are passed to and processed by RFoptions. If params is given, then ... may include also the variables used in params.

Value

An object of the class "RFcrossvalidate" which is a list with the following components, cf. xvalid in the package geoR :

data

the original data.

predicted

the values predicted by cross-validation.

krige.var

the cross-validation prediction variance.

error

the differences data - predicted value.

std.error

the errors divided by the square root of the prediction variances.

p

In contrast to geoR the p-value is returned, i.e. the probability that a difference with absolute value larger than the absolute value of the actual difference is observed.

A method for summary returns summary statistics for the errors and standard errors similar to geoR.

If cross_refit = TRUE and detailed_output = TRUE the returned object also contains a fitted which is a list of fitted models.

Methods

print

prints the summary

summary

gives a summary

Note

An important option is cross_refit that determines whether the model is refitted for each location left out. Default is FALSE. See also RFoptions.

Note

This function does not depend on the value of RFoptions()$PracticalRange. The function RFcrossvalidate always uses the standard specification of the covariance model as given in RMmodel.

Author(s)

References

  • Ribeiro, P.J., Jr. and Diggle, P.J (2014) R package geoR.

  • Burnham, K. P. and Anderson, D. R. (2002) Model selection and Multi-Model Inference: A Practical Information-Theoretic Approach. 2nd edition. New York: Springer.

See Also

Examples

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




## currently disabled!

RandomFields

Simulation and Analysis of Random Fields

v3.3.10
GPL (>= 3)
Authors
Martin Schlather [aut, cre], Alexander Malinowski [aut], Marco Oesting [aut], Daphne Boecker [aut], Kirstin Strokorb [aut], Sebastian Engelke [aut], Johannes Martini [aut], Felix Ballani [aut], Olga Moreva [aut], Jonas Auel[ctr], Peter Menck [ctr], Sebastian Gross [ctr], Ulrike Ober [ctb], Paulo Ribeiro [ctb], Brian D. Ripley [ctb], Richard Singleton [ctb], Ben Pfaff [ctb], R Core Team [ctb]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.