Description Usage Arguments Details Value Examples
The function krylov_mle
is used to fit spatial regression models.
1 2 3 4 |
y |
the response variable. |
X |
the model matrix. |
dist_mat |
the distance matrix. |
cov.model |
a quoted keyword that specifies the covariance function used to model the spatial dependence structure among the observations. Supported keywords are: |
cov.taper |
cov.taper a quoted keyword that specifies the tapering function. Supported keywords are: |
theta.init |
numeric vector, initial values for the covariance parameters to be optimized. |
theta.lower |
vector of lower limit of covariance parameters. |
theta.upper |
vector of upper limit of covariance parameters. |
delta |
tapering threshold parameter. |
ctrl |
A list of control parameters. See 'Details'. |
gls |
If |
nu |
the smooth parameter for the Matern covariance function. |
The ctrl
argument is a list that can supply any of the following components:
convergence tolerance for the conjugate gradient algorithm.
maximum number of iterations for the conjugate gradient algorithm.
a quoted keyword that specifies preconditioner. Supported keywords are:
"no_precond"
,"ICHOL0"
,"ILUT"
,"Jacobi"
,"row scaling"
,
"ILU0"
,"Block-ILU0"
and "Block-ILUT"
.
the order of the Gaussian quadrature rule.
the number of Monte Carlo iterations.
random seed.
A list with components:
A list consists of the regression coefficient beta, the covariance parameter theta, and the solution to the linear system z=Γ^{-1}(y-Xβ) at the kth iteration.
An integer code. 0 indicates successful convergence.
Negative log-likelihood.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | library(spKrylov)
library(foreach)
library(spam)
set.seed(2019)
n <- 70^2 # sample size
delta <- 6 # only distances smaller than delta are recorded.
rep <- 1
data("sim_n_4900rep_1delta_6")
nr <- 1
dist_mat <- nearest.dist(train[, 1:2],
miles = FALSE,
upper = NULL,
delta = delta
)
system.time(
fit.mle <- krylov_mle(
y = train[, 3],
dist_mat = dist_mat,
cov.model = "exponential",
cov.taper = "wend1",
theta.init = c(3, 0.15),
theta.lower = c(0.0001, 0.0001),
theta.upper = c(max(dist_mat), 1),
delta = delta,
ctrl = list(
cg.tol = 1e-6, cg.max_iter = 1000,
cg.precond = "no_precond",
logdet.m = 30, logdet.nr = nr
),
gls = FALSE
)
)
fit.mle$result$theta
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.