envelope {variosig} | R Documentation |
Generate Pointwise Variogram Envelope
Description
Apply Monte Carlo permutation on the data values over different locations, and compute the variogram estimates for each permutation. The pointwise variogram envelope is taken based on quantiles of variogram estimates at each distance binning.
Usage
## S3 method for class 'gstatVariogram'
envelope(vario, data, locations = coordinates(data),
formula = NULL, cluster = FALSE, n.cluster = NULL,
nsim = 999, conf.level = 0.95, save.sim = FALSE, ...)
## S3 method for class 'variogram'
envelope(vario, data, locations = data$coords,
trend = NULL, cluster = FALSE, n.cluster = NULL,
nsim = 999, conf.level = 0.95, save.sim = FALSE, ...)
Arguments
vario |
variogram of class |
data |
an object of class |
locations |
matrix. Contains x-coordinates in the first column and y-coordinates in the second column. |
formula |
only works with |
trend |
only works with |
cluster |
logical. If |
n.cluster |
integer. The number of clusters used in the permutation. Only used when |
nsim |
integer. The number of permutations conducted to compute the envelope. The default is 999. |
conf.level |
confidence level of the envelope. The default is 0.95. |
save.sim |
logical. If |
... |
any other arguments that will be passed to variogram computation using either |
Details
There are two possible permutation methods implemented. If cluster = FALSE
, complete spatial randomness is assumed and values are permuted over all locations. If cluster = TRUE
, spatial dependence at small scales is assumed and and values are permuted only within clusters which are determined using kmeans clustering over spatial locations. When the interest is about the existence of spatial dependence at small scales, cluster = TRUE
is preferred to acheive a higher statistical power.
Value
A list with the following elements:
data |
contains a list of all permutated data, only exists if |
variogram |
the original variogram estimates and estimates from each of the permutations |
upper |
upper quantile of the variogram estimates according to the confidence level |
lower |
lower quantile of the variogram estimates according to the confidence level |
data.values |
the values used for variogram estimation, namely the residuals after removing covariates' effect |
variogram0 |
the original variogram supplied via |
Author(s)
Craig Wang, Reinhard Furrer
References
Diggle, P.J., Ribeiro, P.J. (2007), Model-Based Geostatistics, Springer Series in Statistics. Springer.
Wang, C., Furrer, R. (2018) Monte Carlo Permutation Tests for Assessing Spatial Dependence at Difference Scales. Nonparametric Statistics. (Submitted)
See Also
envplot
to plot an empirical variogram based on the data and its envelope
Examples
## Not run:
library(sp)
data(meuse)
## for gstat variogram
library(gstat)
data(meuse)
coordinates(meuse) = ~x+y
vario0 <- gstat::variogram(log(zinc)~1, meuse)
varioEnv <- envelope(vario0, data = meuse,
formula = log(zinc)~1, nsim = 499, cluster = TRUE, n.cluster = 10)
## for geoR variog
library(geoR)
data(meuse)
meuse <- as.geodata(meuse, coords.col = 1:2, data.col = 6, covar.col = 3:5)
meuse$data <- log(meuse$data)
vario0 <- variog(meuse,max.dist=1500)
varioEnv <- envelope(vario0, data = meuse,
trend = trend.spatial(~lead, meuse), nsim = 499)
## End(Not run)