CovarianceUpper | R Documentation |
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.
ExponentialUpper(distMat, range = 1, alpha = 1/range, theta = NULL)
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 "aRange" scaling argument used in fields covariance functions) |
alpha |
1/range |
theta |
Also the range parameter. |
The covariance matrix, where only the upper triangle is calculated.
John Paige
Exponential
set.seed(123)
#a distance matrix
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.