maxlik.cov.sp {SpatialTools} | R Documentation |
Determines maximum likelihood estimates of covariance parameters
Description
Estimates covariance parameters of spatial covariance functions using maximum likelihood or restricted maximum likelihood. See cov.sp
for more details of covariance functions to be estimated.
Usage
maxlik.cov.sp(X, y, coords, sp.type = "exponential",
range.par = stop("specify range.par argument"),
error.ratio = stop("specify error.ratio argument"),
smoothness = 0.5,
D = NULL, reml = TRUE, lower = NULL, upper = NULL,
control = list(trace = TRUE), optimizer="nlminb")
Arguments
X |
A numeric matrix of size |
y |
A vector of length |
coords |
A numeric matrix of size |
sp.type |
A character vector specifying the spatial covariance type. Valid types are currently exponential, gaussian, matern, and spherical. |
range.par |
An initial guess for the spatial dependence parameter. |
error.ratio |
A value non-negative value indicating the ratio |
smoothness |
A positive number indicating the smoothness of the matern covariance function, if applicable. |
D |
The Euclidean distance matrix for the coords matrix. Must be of size |
reml |
A boolean value indicating whether restricted maximum likelihood estimation should be used. Defaults to TRUE. |
lower |
A vector giving lower bounds for the covariance parameters |
upper |
A vector giving upper bounds for the covariance parameters |
control |
A list giving tuning parameters for the |
optimizer |
A vector describing the optimization function to use for the optimization. Currently, only |
Details
When doing the numerical optimizaiton, the covariance function is reparameterized slightly to speedup computation.
Specifically, the variance parameter for the process of interest,sp.par[1]
, is profiled out,
and the error.var
parameter is parameterized as sp.par[1] * error.ratio
, where error.ratio = error.var/sp.par[1]
.
Value
Returns a list with the following elements:
sp.type |
The covariance form used. |
sp.par |
A vector containing the estimated variance of the hidden process and the spatial dependence. |
error.var |
The estimated error variance. |
smoothness |
The smoothness of the matern covariance function. |
par |
The final values of the optimization parameters. Note that these will not necessarily match |
convergence |
Convergence message from |
message |
Message from |
iterations |
Number of iterations for optimization to converge. |
evaluations |
Evaluations from |
Author(s)
Joshua French
See Also
cov.st
Examples
#generate 20 random (x, y) coordinates
coords <- matrix(rnorm(20), ncol = 2)
#create design matrix
X <- cbind(1, coords)
#create mean for observed data to be generated
mu <- X %*% c(1, 2, 3)
#generate covariance matrix
V <- exp(-dist1(coords))
#generate observe data
y <- rmvnorm(mu = mu, V = V)
#find maximum likelihood estimates of covariance parameters
maxlik.cov.sp(X = X, y = y, coords = coords,
sp.type = "exponential", range.par = 1, error.ratio = 0,
reml = TRUE)