Krig.sparse {KriSp}R Documentation

Kriging surface estimate

Description

Calculating the BLUP or kriging estimate for large two dimensional spatial datasets.

Usage

Krig.sparse(x,Y,
        cov.fun="expo.cov", cov.fun.args=list(range=10,eps=eps),
        taper.fun="spher.cov", taper.fun.args=list(range=10),
        ncov=10000,approxhmax=taper.fun.args$range,              
        miles=TRUE,R=NULL, eps=1e-5,
        xM=NULL, m=2,scale.type = "user",x.center = rep(0, ncol(x)),
        x.scale = rep(1, ncol(x)),
        maxiter=25,epsiter=1e-3,
        save.sigma=TRUE,save.chol=FALSE,verbose=FALSE,                        
        nnzmax=100000,tmpmax=10000,...)

Arguments

x a m times 2 matrix containing the locations.
Y the observed values at x.
cov.fun Covariance function in the form of an R function, or its name as a string.
cov.fun.args A list with the arguments to call the covariance function (in addition to the locations).
taper.fun Taper function in the form of an R function, or its name as a string.
taper.fun.args A list with the arguments to call the taper function (in addition to the locations).
ncov Number of knots to evaluate the approximation
approxhmax Maximum distance over which the covariance is approximated
miles logical. If TRUE (default) distances are in statute miles if FALSE distances in kilometers.
R the radius to use for the sphere to find spherical distances. If NULL the radius is either in miles or kilometers of the earth depending on the values of the miles argument. If R=1 then distances are in radians.
eps small value, everything smaller is considered zero.
xM a m times 2 matrix containing the values for the spatial drift. By default, the locations are used.
m A polynomial function of degree (m-1) will be included in the model as the spatial trend (drift) component.
scale.type A character string among: range, unit.sd, user, unscaled. The independent variables are scaled to the specified type. See below.
x.center Centering values to be subtracted from each column of the x matrix.
x.scale Scale values that are divided into each column after centering.
maxiter Maximum number of iterations used in the backfitting iteration
epsiter Stop the backfitting as soon as the sum of squares of the coefficients of two consecutive iterations is smaller.
save.sigma should the covariance matrix be saved (in SparseM format).
save.chol should the Cholesky factor of the covariance matrix be saved (in SparseM format).
verbose should timing and convergence results be printed.
nnzmax upper bound of non-zero elements in the covariance matrix.
tmpmax working array for the Cholesky factorisation
... supplementary parameters that can be given as arguments to the function chol.

Details

For computational reasons, we do not call simple the solve function but use chol(...) and backsolve(...) form the SparseM library. We do not allow missing values. We only consider two-dimensional domains.

Concerning the scaling for the spatial trend. By default no scaling is done. Scale type of range scales the data to the interval (0,1) by forming (x-min(x))/range(x) for the x- and y-axis. Scale type of unit.sd subtracts the mean and divides by the standard deviation. Scale type of user allows specification of an x.center and x.scale by the user. The default for user is mean 0 and standard deviation 1. Scale type of unscaled does not scale the data.

Value

Krig.sparse returns an object of class c("sparse","Krig"). The second is to reuse many handy functions of the library fields.
An object of the class "sparse" is a list containing at least the following components:

call the matched call.
iternorm norm of coefficients for each iteration.
trend fitted trend surface at observed values.
coef coefficients of trend surface.
spatial spatial part of surface at observed values.
solve vector used for prediction on other grid points.
sigma if requested, the covariance matrix.
sigmachol if requested, the Cholesky factor.
timing time needed for the main calculations.
nnz The number of nonzero elements in the covariance matrix and its Cholesky factor.


Additionally, most input arguments are passed to the object.

Note

For REALLY big datasets, it would be wise to dissect the functions.

The radius of the earth is assumed to be 3963.34 miles or 6378.388 kilometers.

approxhmax should be at least as big as the taper range or the domain of the field.

If nnzmax is too small, R may produce a `core dumped'.

See Also

Krig.simple.sparse, predict.sparse, plot.sparse;

transformx from the fields library; chol and backsolve from the SparseM library.

Examples

data(universal)
attach(universal.data)

obj <- Krig.sparse(x, Y,
          cov.fun.args=list(range=10,sill=.9,nugget=.1))

summary(obj)

image.plot( predict.surface(obj))
image.plot( predict.surface(obj, trend.only=TRUE))

[Package KriSp version 0.4 Index]