spVariog {spANOVA} | R Documentation |
Compute empirical residual variogram for CRD or RCBD.
Description
Compute empirical residual variogram for a Completely Randomized Design (CRD) or a Randomized Complete Block Design (RCBD) by a call to variog function of the package geoR.
Usage
spVariog(geodata, resp = NULL, treat = NULL, block = NULL, coords = NULL,
data = NULL, trend = c("cte", "1st"), scale = FALSE, max.dist,
design = c("crd", "rcbd"), ...)
Arguments
geodata |
an object of class |
resp |
either a vector of response variables or a character giving the column name where it can be found in 'data'. Optional argument, just required if geodata is not provided. |
treat |
either a vector of treatment factors or a character giving the column name where it can be found in 'data'. Optional argument, just required if geodata is not provided. |
block |
either a vector of block factors or a character giving the column name where it can be found in 'data'. Optional argument, just required if geodata is not provided. |
coords |
either a 2-column matrix containing the spatial coordinates or a character vector giving the columns name where the coordinates can be found in 'data'. Optional argument, just required if geodata is not provided. |
data |
a data frame in which the variables specified as characters will be found. Optional argument, just required if geodata is not provided. |
trend |
type of spatial trend considered. |
scale |
logical argument. Should the coordinates be scaled? We recommend this argument to be set as TRUE if your spatial coordinates have high values as in UTM coordinate system otherwise, you could get errors in the calculations. See ‘Details’. |
max.dist |
numerical value defining the maximum distance for the variogram.
See |
design |
type of experimental design. "crd" corresponds to Completely Randomized Design and "rcbd" corresponds to Randomized Complete Block Design. |
... |
further arguments to be passed to |
Details
This function provides a wrapper to variog to compute residual variogram for experimental designs. The residuals are obtained by
\varepsilon = Y-X\beta,
where Y is the vector of response, X is the design matrix built according to the experimental design
chosen, and \beta
is the vector of coefficients estimated by the linear model.
If scale = TRUE the spatial coordinates will be scaled for numerical reasons. The scale is made by subtracting the minimum spatial coordinate value from all others.
Value
An object of class spVariog which is a list with the following components:
vario.res |
an object of class variogram |
data.geo |
an object of class geodata |
des.mat |
the design matrix |
trend |
a character specifying the type of spatial trend |
See Also
Examples
data("crd_simulated")
dados <- crd_simulated
#Geodata object
geodados <- as.geodata(dados, coords.col = 1:2, data.col = 3,
covar.col = 4)
h_max <- summary(geodados)[[3]][[2]]
dist <- 0.6*h_max
# Computing the variogram
variograma <- spVariog(geodata = geodados,
trend = "cte", max.dist = dist, design = "crd",
scale = FALSE)
plot(variograma, ylab = "Semivariance", xlab = "Distance")