Learn R Programming

sommer (version 3.2)

variogram: Sample variogram

Description

Computes the sample variogram a dataset, usually residuals obtained from an mmer-type of functions.

Usage

# S3 method for MMERM
variogram(x, xcoor="ROW", ycoor="RANGE", 
     zcoor=NULL, by=NULL, ...)

Arguments

x

a data frame with the 3 dimensions (columns) to be plotted. Ideally for inspecting the residuals.

xcoor

a character argument indicating the name of the column in the dataset corresponding to the x coordinate.

ycoor

a character argument indicating the name of the column in the dataset corresponding to the y coordinate.

zcoor

a character argument indicating the name of the column in the dataset corresponding to the z coordinate.

by

a character argument indicating the name of the column in the dataset in case multiple residual plots are required and divided by a factor.

further arguments passed to or from other methods. Not yet implemented

Value

An object of class with the following components:

data

data frame including the following information: ``value'': the value of the sample variogram at each pair of column and row displacements; and ``length'': the number of observations used to compute the sample variogram at the corresponding pair of displacements.

col.displacement

numerical vector containing the column displacements

row.displacement

numerical vector containing the row displacements

Details

The present function computes the sample variogram on the basis of the (deviance) residuals of the fitted model. Currently, the function can only be applied for regular two-dimensional data, i.e, when the plots of the field are arranged in a regular two-dimensional array (usually defined by the column and row positions). For each pair of (deviance) residuals \(e_i\) and \(e_j\), the half-squared difference is computed $$v_{ij} = 0.5(e_i - e_j)^2,$$ as well as the corresponding column (\(cd_{ij}\)) and row displacements (\(rd_{ij}\)), with $$cd_{ij} = |c_i - c_j|$$ and $$rd_{ij} = |r_i - r_j|,$$ where \(c_k\) and \(r_k\) denote the column and row position of plot \(k\) respectively. The sample variogram is then defined as the triplet $$(cd_{ij}, rd_{ij}, \bar{v}_{ij}),$$ where \(\bar{v}_{ij}\) denotes the average of the \(v_{ij}\) that share the same column and row displacements. For a more detailed description, see Gilmour et al. (1997).

References

Gilmour, A.R., Cullis, B.R., and Verbyla, A.P. (1997). Accounting for Natural and Extraneous Variation in the Analysis of Field Experiments. Journal of Agricultural, Biological, and Environmental Statistics, 2, 269 - 293.

Stefanova, K.T., Smith, A.B. and Cullis, B.R. (2009). Enhanced Diagnostics for the Spatial Analysis of Field Trials. Journal of Agricultural, Biological, and Environmental Statistics, 14, 392 - 410.

See Also

mmer2

Examples

Run this code
# NOT RUN {
data(CPdata)
#### look at the data and fit the model
head(CPpheno)
mix1 <- mmer2(Yield~1,
              random=~ id
                      + Rowf + Colf,
              rcov=~units,
              data=CPpheno)
summary(mix1)

# compute the variogram
vm0 <- variogram(mix1, xcoor = "Row", ycoor = "Col")
# plot the variogram
plot(vm0$F1)
# }

Run the code above in your browser using DataLab