Krig.engine.default: Basic linear algebra utilities and other computations...

The Engines:R Documentation

Basic linear algebra utilities and other computations supporting the Krig function.

Description

These are internal functions to Krig that compute the basic matrix decompositions or solve the linear systems needed to evaluate the Krig/Tps estimate. Others listed below do some simple housekeeping and formatting. Typically they are called from within Krig but can also be used directly if passed a Krig object list.

Usage

Krig.engine.default(out, verbose = FALSE)
Krig.engine.fixed( out, verbose=FALSE, lambda=NA)

Krig.coef(out, lambda = out$lambda, y = NULL, yM = NULL, verbose = FALSE) 
Krig.make.u(out, y = NULL, yM = NULL, verbose = FALSE) 
Krig.check.xY(x, Y,Z, weights, na.rm, verbose = FALSE) 
Krig.transform.xY(obj, knots, verbose = FALSE)

Krig.make.W( out, verbose=FALSE)
Krig.make.Wi ( out, verbose=FALSE)

Arguments

out

A complete or partial Krig object. If partial it must have all the information accumulated to this calling point within the Krig function.

obj

Same as out.

verbose

If TRUE prints out intermediate results for debugging.

lambda

Value of smoothing parameter "hard wired" into decompositions. Default is NA, i.e. use the value in out\$lambda.

y

New y vector for recomputing coefficients. OR for %d*% a vector or matrix.

yM

New y vector for recomputing coefficients but the values have already been collapsed into replicate group means.

Y

raw data Y vector

x

raw x matrix of spatial locations OR In the case of %d*%, y is either a matrix or a vector. As a vector, y, is interpreted to be the elements of a digaonal matrix.

weights

Raw weights vector passed to Krig

Z

Raw vector or matrix of additional covariates.

na.rm

NA action logical values passed to Krig

knots

Raw knots matrix passed to Krig

Details

ENGINES:

The engines are the code modules that handle the basic linear algebra needed to computed the estimated curve or surface coefficients. All the engine work on the data that has been reduced to unique locations and possibly replicate group means with the weights adjusted accordingly. All information needed for the decomposition are components in the Krig object passed to these functions.

Krig.engine.default finds the decompositions for a Universal Kriging estimator by simultaneously diagonalizing the linear system system for the coefficients of the estimator. The main advantage of this form is that it is fairly stable numerically, even with ill-conditioned covariance matrices with lambda > 0. (i.e. provided there is a "nugget" or measure measurement error. Also the eigendecomposition allows for rapid evaluation of the likelihood, GCV and coefficients for new data vectors under different values of the smoothing parameter, lambda.

Krig.engine.knots This code has been omitted from verisions >= 12.0. See 11.6 too recover this functionality.

Finds the decompositions in the case that the covariance is evaluated at arbitrary locations possibly different than the data locations (called knots). The intent of these decompositions is to facilitate the evaluation at different values for lambda.

Krig.engine.fixed are specific decomposition based on the Cholesky factorization assuming that the smoothing parameter is fixed. This is the only case that works in the sparse matrix. Both knots and the full set of locations can be handled by this case. The difference between the "knots" engine above is that only a single value of lambda is considered in the fixed engine.

OTHER FUNCTIONS:

Krig.coef Computes the "c" and "d" coefficients to represent the estimated curve. These coefficients are used by the predict functions for evaluations. Krig.coef can be used outside of the call to Krig to recompute the fit with different Y values and possibly with different lambda values. If new y values are not passed to this function then the yM vector in the Krig object is used. The internal function Krig.ynew sorts out the logic of what to do and use based on the passed arguments.

Krig.make.u Computes the "u" vector, a transformation of the collapsed observations that allows for rapid evaluation of the GCV function and prediction. This only makes sense when the decomposition is WBW or DR, i.e. an eigen decomposition. If the decompostion is the Cholesky based then this function returns NA for the u component in the list.

Krig.check.xY Checks for removes missing values (NAs).

Krig.cor.Y This code has been omitted from verisions >= 12.0. See 11.6 too recover this functionality.

Krig.transform.xY Finds all replicates and collapse to unique locations and mean response and pooled variances and weights. These are the xM, yM and weightsM used in the engines. Also scales the x locations and the knots according to the transformation.

Krig.make.W and Krig.make.Wi These functions create an off-diagonal weight matrix and its symmetric square root or the inverse of the weight matrix based on the information passed to Krig. If out$nondiag is TRUE W is constructed based on a call to the passed function wght.function along with additional arguments. If this flag is FALSE then W is just diag(out$weightsM) and the square root and inverse are computed directly.

%d*% Is a simple way to implement efficient diagonal multiplications. x%d*%y is interpreted to mean diag(x)%*% y if x is a vector. If x is a matrix then this becomes the same as the usual matrix multiplication.

Returned Values

ENGINES:

The returned value is a list with the matrix decompositions and other information. These are incorporated into the complete Krig object.

Common to all engines:

decomp

Type of decomposition

nt

dimension of T matrix

np

number of knots

Krig.engine.default:

u

Transformed data using eigenvectors.

D

Eigenvalues

G

Reduced and weighted matrix of the eigenvectors

qr.T

QR decomposition of fixed regression matrix

V

The eigenvectors

Krig.engine.fixed:

d

estimated coefficients for the fixed part of model

c

estimated coefficients for the basis functions derived from the covariance function.

Using all data locations

qr.VT

QR decomposition of the inverse Cholesky factor times the T matrix.

MC

Cholesky factor

Using knot locations

qr.Treg

QR decomposition of regression matrix modified by the estimate of the nonparametric ( or spatial) component.

lambda.fixed

Value of lambda used in the decompositions

OTHER FUNCTIONS:

Krig.coef

yM

Y values as replicate group means

tauHat.rep

Sample standard deviation of replicates

tauHat.pure.error

Same as tauHat.rep

pure.ss

Pure error sums of squares based on replicates

c

The "c" basis coefficients associated with the covariance or radial basis functions.

d

The "d" regression type coefficients that are from the fixed part of the model or the linear null space.

u

When the default decomposition is used the data vector transformed by the orthogonal matrices. This facilitates evaluating the GCV function at different values of the smoothing parameter.

Krig.make.W

W

The weight matrix

W2

Symmetric square root of weight matrix

Krig.make.Wi

Wi

The inverse weight matrix

W2i

Symmetric square root of inverse weight matrix

Author(s)

Doug Nychka

See Also

Krig, Tps

Examples


Krig( ChicagoO3$x, ChicagoO3$y, aRange=100)-> out

Krig.engine.default( out)-> stuff

# compare "stuff" to components in out$matrices

look1<- Krig.coef( out)
look1$c
# compare to out$c

look2<- Krig.coef( out, yM = ChicagoO3$y)
look2$c
# better be the same even though we pass as new data!


fields documentation built on June 28, 2024, 1:06 a.m.