chol_s2Dp | R Documentation |
The function first builds a correlation matrix with correlation.builder,
converts that matrix to a covariance matrix if necessary, and then takes
the Cholesky decomposition of the matrix using either base R or the R
package spam
. Note that spam
is particularly effective when
the matrix is sparse.
chol_s2Dp(
matrix.type = "cov",
im.res,
use.spam = FALSE,
corr.structure = "ar1",
rho = NULL,
phi = NULL,
tau = 1,
alpha = 0.75,
corr.min = NULL,
neighborhood = "none",
w = NULL,
h = NULL,
r = NULL,
print.R = FALSE,
print.S = FALSE,
print.Q = FALSE,
sigma = 1,
triangle = "upper",
print.all = FALSE,
round.d = FALSE,
return.cov = TRUE,
return.prec = TRUE
)
matrix.type |
Determines whether to build a covariance matrix,
|
im.res |
A vector defining the dimension of spatial data. The first entry is the number of rows and the second entry is the number of columns. |
use.spam |
If |
corr.structure |
One of |
rho |
This is the maximum possible correlation between locations i
and j. For all i,j |
phi |
A scalar value greater than 0 that determines the decay rate of
correlation. This argument is only utilized when |
tau |
A vector containing precision parameters. If of length 1, then
all precisions are assumed equal. Otherwise the length of |
alpha |
A scalar value between 0 and 1 that defines the strength of
correlations. Note that when |
corr.min |
Scalar value to specify the minimum non-zero correlation.
Any correlations below |
neighborhood |
Defines the neighborhood within which marginal
correlations are non-zero. The default is |
w, h |
If |
r |
If |
print.R, print.S, print.Q |
Logical. When |
sigma |
Specify the desired standard deviations; the default is 1, in
which case the Cholesky decomposition is of a correlation matrix. If
|
triangle |
Determine whether to output an upper
( |
print.all |
If |
round.d |
If |
return.cov, return.prec |
Logical. When |
Matrix of dimension (n.row x n.col) x (n.row x n.col). If either
return.cov
or return.prec
is TRUE
, then returns a
list where the first element is the covariance or precision matrix, and the
second element is the Cholesky factor.
Banerjee:2015sim2Dpredictr
\insertRefRipley:1987sim2Dpredictr
\insertRefRue:2001sim2Dpredictr
\insertRefspamsim2Dpredictr
## Use R package spam for Cholesky decomposition
R_spam <- chol_s2Dp(im.res = c(3, 3), matrix.type = "prec",
use.spam = TRUE, neighborhood = "ar1",
triangle = "upper")
## Use base R for Cholesky decomposition
R_base <- chol_s2Dp(corr.structure = "ar1",
im.res = c(3, 3), rho = 0.15,
neighborhood = "round",
r = 3, use.spam = FALSE)
## Specify standard deviations instead of default of sigma = 1.
R_sd <- chol_s2Dp(corr.structure = "ar1",
im.res = c(3, 3), rho = 0.15,
neighborhood = "round", r = 3,
sigma = runif(9, 1.1, 4))
## Not run:
## Print options ON
R_pr_on <- chol_s2Dp(corr.structure = "ar1",
im.res = c(3, 3), rho = 0.15,
sigma = 1:9, neighborhood = "round",
r = 3, print.R = TRUE, print.S = TRUE)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.