Calculates spatial covariance matrix of the observed responses, and
possibly, the responses to be predicted.
If pcoords
is not provided, then only V
,
the covariance matrix of the observed responses will be returned.
If pcoords
is provided, then Vp
and Vop
(the covariance matrix for predicted responses and between observed and
predicted responses, respectively) will also be returned.
cov.st(coords, time, sp.type = "exponential",
sp.par = stop("specify sp.par argument"),
error.var = 0, smoothness = 0.5, finescale.var = 0,
t.type = "ar1", t.par = .5,
pcoords = NULL, ptime = NULL,
D = NULL, Dp = NULL, Dop = NULL,
T = NULL, Tp = NULL, Top = NULL)
Returns a list with the following elements:
The covariance matrix for the observed responses.
The covariance matrix for the predicted responses. Only returned if pcoords
is supplied.
The covariance matrix between the observed responses and the predicted responses. Only returned if pcoords
is supplied. Will be of size \(n \times np\)
A numeric matrix of size \(n \times d\) containing the observed data locations.
A numeric matrix of size \(n \times 1\) containing the times at which the data was observed.
A character vector specifying the spatial covariance type. Valid types are currently exponential, gaussian, matern, and spherical.
A vector of length 2 specifying the scale and dependence of the covariance function. The first element refers to the variance of the hidden process (sometimes this is called the partial sill) while the second elements determines the strength of dependence between locations.
A non-negative number indicating the variance of the error term.
A positive number indicating the variance of the error term.
A non-negative positive number indicating the finescale variability. The is also called the microscale variance
A character vector indicating the temporal dependance structure. Currently, only "ar1" is implemented.
A numeric vector of length 1 indicating the strength of temporal dependence.
A numeric matrix of size \(np \times d\) containing the locations of the responses to be predicted
A numeric matrix of size \(np \times 1\) containing the times at which the responses are to be predicted.
The Euclidean distance matrix for the coords matrix. Must be of size \(n \times n\).
The Eucliean distance matrix for the pcoords matrix. Must be of size \(np \times np\).
The Eucliean intersite distance matrix between the locations in coords and the locations in pcoords. Must be of size \(n \times np\).
The Euclidean distance matrix for the time matrix. Must be of size \(n \times n\).
The Eucliean distance matrix for the ptime matrix. Must be of size \(np \times np\).
The Eucliean intertime distance matrix between the times in time
and ptime
. Must be of size \(n \times np\).
Joshua French
At this point, this function only implements a separable spatio-temporal covariance funcation. If \(h\) is the distance between two sites, and \(t\) is the temporal lag between the times when the associated responses were observed, then the covariance function \(C(h,t) = Cs(h) \times Ct(t)\) where \(Cs\) is a spatial covariance function corresponding to the exponential, matern, gaussian, or spherical and \(Ct\) is the temporal covariance function corresponding to an ar1 process with \(Ct(t) = \phi ^ t\).
The D
, Dp
, Dop
, T
, Tp
, Top
arguments are supplied to decrease the number of necessary computations needed when performing repetitive analysis or simulations. It is probably in the user's interest to not supply these arguments unless the duration of analysis is an important consideration. Note that these arguments override the information given in coords
, pcoords
, time
, and prime
, i.e., if dist1(coords) != D, then D is used in subsequent calculations, etc. This could create problems.
simple.cov.sp
coords <- matrix(rnorm(30), ncol = 3)
pcoords <- matrix(rnorm(90), ncol = 3)
time <- 1:10
ptime <- 1:30
cov.st(coords = coords, time = time, sp.type = "exponential",
sp.par = c(2, 1), error.var = 1, t.type = "ar1", t.par = .5,
pcoords = pcoords, ptime = ptime)
Run the code above in your browser using DataLab