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

CovarianceUpper

Evaluate covariance over upper triangle of distance matrix


Description

Evaluates the covariance over the upper triangle of a distance matrix rather than over the entire matrix to reduce computation time. Note that the chol function only requires the upper triangle of the covariance matrix to perform the Cholesky decomposition.

Usage

ExponentialUpper(distMat, range = 1, alpha = 1/range)

Arguments

distMat

The distance matrix to evaluate the covariance over.

range

Range parameter default is one. Note that the scale can also be specified through the "theta" scaling argument used in fields covariance functions)

alpha

1/range

Value

The covariance matrix, where only the upper triangle is calculated.

Author(s)

John Paige

See Also

Examples

set.seed(123)

#make distance matrix using the random locations
coords = matrix(runif(10), ncol=2)
distMat = rdist(coords)

#compute covariance matrix, but only over the upper triangle
upperCov = ExponentialUpper(distMat, range=.1)

print(distMat)
print(upperCov)

fields

Tools for Spatial Data

v11.6
GPL (>= 2)
Authors
Douglas Nychka [aut, cre], Reinhard Furrer [aut], John Paige [aut], Stephan Sain [aut], Florian Gerber [aut], Matthew Iverson [aut], University Corporation for Atmospheric Research [cph]
Initial release
2020-10-06

We don't support your browser anymore

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