Learn R Programming

RandomFields (version 3.0.5)

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. Currenty, the model to be fitted can be linear models

Usage

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

Arguments

model, x, y, z, T, grid, data,lower, upper, bc_lambda, users.guess, distances, dim, optim.control, transform, ...
see RFfit
method
Single method to be used for estimating, either one of the methods or one of the sub.methods see RFfit
full
logical. if TRUE then crossvalidatiaon is also performed for intermediate models used in RFfit (if any).

Value

  • An object of the class "RFcrossvalidate" which is a list with the following components, cf. xvalid in the package geoR :
  • datathe original data.
  • predictedthe values predicted by cross-validation.
  • krige.varthe cross-validation prediction variance.
  • errorthe differences data - predicted value.
  • std.errorthe errors divided by the square root of the prediction variances.
  • pIn 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 constains a fitted which is a list of fitted models.

References

  • Ribeiro, P.J., Jr. and Diggle, P.J (2014) R packagegeoR.
  • 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

RFratiotest RFfit RMmodel, RandomFields, weather.

Examples

Run this code
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")

n <- if (interactive()) 100 else 5

#########################################################
## simulate some data first
points <- if (interactive()) 100 else 40
x <- runif(points, 0, 3)
y <- runif(points, 0, 3) ## random points in square [0, 3]^2
model <- RMgencauchy(alpha=1, beta=2)
d <- RFsimulate(model, x=x, y=y, grid=FALSE, n=n) #1000


#########################################################
## estimation; 'NA' means: "to be estimated"
estmodel <- RMgencauchy(var=NA, scale=NA, alpha=NA, beta=2) +
            RMtrend(mean=NA)
RFcrossvalidate(estmodel, data=d)


RFoptions(modus_operandi="normal")
FinalizeExample()

Run the code above in your browser using DataLab