Description Usage Arguments Details Value Note See Also Examples
getCovMatNSR
returns a non-stationary covariance matrix (with nugget).
1 | getCovMatNSR(V, R, sig2eps)
|
V |
A positive vector of length n. |
R |
An n x n correlation matrix. |
sig2eps |
A positive scalar representing the variance of the noise (or nugget). |
This creates a covariance matrix, C, where
C = V^{0.5}RV^{0.5} + σ^2_ε I
where V is a matrix with process variances (from vector V above) on the diagonal, R is a correlation matrix, and σ^2_ε is the variance of the noise (or nugget).
An n x n covariance matrix
Surprisingly, this method is substantially faster, even for relatively large
matrices (tested up to 5000 x 5000
), than doing sparse matrix
multiplication in the Matrix package. Sparse matrix multiplication was orders
of magnitude slower for small matrices than the method implemented above or
for diag(V)^0.5 %*% R %*% diag(V)^0.5
, which was roughly the same
speed as above for small matrices, but much slower for large matrices.
Other correlation and covariance functions: combineCorMatsR
,
getCorMatR
, getCovMatSR
1 2 3 4 5 6 7 8 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.