Learn R Programming

geoRglm (version 0.9-16)

covariog: Empirical Covariogram for a Model with log-link and an Underlying Gaussian Field

Description

Computes the sample empirical (sample) covariogram described in Christensen, Moller and Waagepetersen (2000). Output is returned as a binned covariogram. The function is NOT a general function for computing the covariogram, and it is in fact of very limited use.

Usage

covariog(geodata, coords = geodata$coords, data = geodata$data,
         units.m = "default", uvec = "default", bins.lim = "default",
         estimator.type = c("poisson", "not-poisson"),
         max.dist = NULL, pairs.min = 2)

Arguments

geodata

a list containing elements data and coords as described next. Typically an object of the class "geodata" - a geoR data set. If not provided the arguments data and coords must be provided instead. The list may also contain an argument units.m as described below.

coords

an \(n \times 2\) matrix containing coordinates of the \(n\) data locations in each row. Default is geodata$coords, if provided.

data

a vector or matrix with data values. If a matrix is provided, each column is regarded as one variable or realization. Default is geodata$data, if provided.

units.m

\(n\)-dimensional vector of observation times for the data. By default (units.m = "default"), it takes geodata$units.m in case this exist and else a vector of 1's.

uvec

a vector with values defining the covariogram binning. The values of uvec defines the midpoints of the bins. If \(uvec[1] > 0\) the first bin is: \(0 < u <= uvec[2] - 0.5*(uvec[2] - uvec[1])\). If \(uvec[1] = 0\) first bin is: \(0 < u <= 0.5*uvec[2]\), and \(uvec[1]\) is replaced by the midpoint of this interval. The default (uvec = "default") is that \(uvec[i]=max.dist*(i-1)/14\) for \(i=1,\ldots,15\).

bins.lim

separating values for the binning. By default these values are defined via the argument of uvec.

estimator.type

"poisson" estimates the value \(\hat{C}(0)\) using the Poisson assumption. "not-poisson" doesn't compute \(\hat{C}(0)\).

max.dist

a number defining the maximal distance for the covariogram. Pairs of locations separated by a larger distance than this value are ignored in the covariogram calculation. Default is the maximum distance between pairs of data locations.

pairs.min

An integer number defining the minimum number of pairs for the bins. Bins with number of pairs smaller than this value are ignored.

Value

An object of the class covariogram which is a list with the following components:

u

a vector with distances.

v

a vector with estimated covariogram values at distances given in u. When estimator.type = "poisson", the first value in v is the estimate of \(\sigma^2\), \(\hat{C}(0)\).

n

number of pairs in each bin. When estimator.type = "poisson", the first value in n is v0.

v0

the estimate of \(\sigma^2\), \(\hat{C}(0)\).

bins.lim

Separating values for the binning provided in the function call.

estimator.type

echoes the type of estimator used.

call

The function call.

Details

Covariograms can be used in geostatistical analysis for exploratory purposes, to estimate covariance parameters and/or to compare theoretical and fitted models against the empirical covariogram.

The covariogram computed by this function assumes a specific model, a spatial GLMM, and furthermore it assumes that the link-function is the logarithm (i.e. it should not be used for the binomial-logistic model !).

Assume that the conditional distribution of \(Y_i\) given \(S_i\) has mean \(t_i\exp(S_i)\), where the values of \(t_i\) are given in units.m. The estimator implemented is $$ \hat{C}(u) = \log\left(\frac{\frac{1}{|W_u^{\Delta}|} \sum_{(i,j)\in W_u^{\Delta}} Y(x_i) Y(x_j) /(t_i t_j)}{\left(\frac{1}{n}\sum_{i=1}^nY(x_i)/t_i\right)^2}\right), \ \ u > 0$$ When a Poisson distribution is assumed, then $$ \hat{C}(0) = \log\left(\frac{\frac{1}{n}\sum_{i=1}^nY(x_i)(Y(x_i)-1)/t_i^2}{\left(\frac{1}{n}\sum_{i=1}^nY(x_i)/t_i\right)^2}\right)$$

References

Christensen, O. F., Moller, J. and Waagepetersen R. (2000). Analysis of spatial data using generalized linear mixed models and Langevin-type Markov chain Monte Carlo. Research report R-00-2009, Aalborg University.

See Also

covariog.model.env for covariogram envelopes and plot.covariogram for graphical output.

Examples

Run this code
# NOT RUN {
data(p50)
covar <- covariog(p50, uvec=c(1:10))
plot(covar)
## Now excluding the bin at zero (only assuming log-link).
covar2 <- covariog(p50,uvec=c(1:10), estimator.type="no")
plot(covar2)
# }

Run the code above in your browser using DataLab