Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

maxlik.cov.st

Determines maximum likelihood estimates of covariance parameters


Description

Estimates covariance parameters of spatio-temporal covariance functions using maximum likelihood or restricted maximum likelihood. See cov.st for more details of covariance functions to be estimated. The covariance function is reparameterized slightly to speedup computation. Specifically, the variance parameter for the hidden process, sp.par[1], is profiled out and the error.var parameter is parameterized as sp.par[1] * error.ratio.

Usage

maxlik.cov.st(X, y, coords, time, sp.type = "exponential", 
	    range.par = stop("specify range.par argument"), 
	    error.ratio = stop("specify error.ratio argument"), 
	    smoothness = 0.5, t.type = "ar1", t.par = .5, D = NULL, T = NULL, 
	    reml = TRUE, lower = NULL, upper = NULL, control = list(trace = TRUE), 
	    optimizer="nlminb")

Arguments

X

A numeric matrix of size n \times k containing the design matrix of the data locations.

y

A vector of length n containing the observed responses.

coords

A numeric matrix of size n \times d containing the locations of the observed responses.

time

A numeric vector of length n containing the time at which the responses were observed.

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 error.var/sp.par[1].

smoothness

A positive number indicating the variance of the error term.

t.type

A character vector indicating the spatial covariance type. Only ar1 is currently available.

t.par

A value specifying the temporal dependence parameter of the ar1 process.

D

The Euclidean distance matrix for the coords matrix. Must be of size n \times n.

T

The Euclidean distance matrix for the time matrix. Must be of size n \times n.

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 sp.par[2], error.ratio, and smoothness (when the model is matern). Order matters! If not given defaults to a lower bound of .001 for sp.par[2], 0 for error.ratio, and .001 for smoothness.

upper

A vector giving upper bounds for the covariance parameters sp.par[2], error.ratio, and smoothness (when the model is matern). Order matters! If not given defaults to an upper bound of Inf for sp.par[2], 1 for error.ratio, and 10 for smoothness.

control

A list giving tuning parameters for the nlminb function. See nlminb for more details.

optimizer

A vector describing the optimization function to use for the optimization. Currently, only nlminb is an acceptable value.

Details

When doing the numerical optimization, 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 sp.par, error.var, and smoothness because of the reparameterization.

convergence

Convergence message from nlminb.

message

Message from nlminb.

iterations

Number of iterations for optimization to converge.

evaluations

Evaluations from nlminb.

Author(s)

Joshua French

See Also

cov.st

Examples

#Generate locations and observed times
coords <- matrix(rnorm(40), ncol = 2)
time <- rep(1:2, each = 10)

#Calculate distance matrix for time vector
T <- dist1(matrix(time))

#create design matrix
X <- cbind(1, coords)

#create mean for observed data to be generated
mu <- X %*% c(1, 2, 3)

#generate covariance matrix for spatio-temporal data
V <- exp(-dist1(coords)) * .25^T

#generate observe data
y <- rmvnorm(mu = mu, V = V)

maxlik.cov.st(X = X, y = y, coords = coords, time = time,
    sp.type = "exponential", range.par = 1, error.ratio = 0, 
    t.type = "ar1", t.par = .5, reml = TRUE)

SpatialTools

Tools for Spatial Data Analysis

v1.0.4
GPL (>= 2)
Authors
Joshua French <joshua.french@ucdenver.edu>
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.