variogram | R Documentation |
Computes isotropic and anisotropic empirical variograms from the residuals of a breedR model.
variogram(
x,
plot = c("all", "isotropic", "anisotropic", "perspective", "heat", "none"),
R,
coord,
z
)
## S3 method for class 'breedR.variogram'
print(x, minN = 30, ...)
x |
a |
plot |
character. What type of variogram is to be plotted. The default is 'all'. Other options are 'isotropic', 'heat', 'perspective' and 'anisotropic'. See Details. |
R |
numeric. Radius of the variogram |
coord |
(optional) a two-column matrix with coordinates of observations |
z |
(optional) a numeric vector of values to be represented spatially |
minN |
numeric. Variogram values computed with less than |
... |
not used. |
An empirical variogram computes the mean squared differences between
observations separated by a vector h
, for all possible h
. An
isotropic
variogram assumes that the underlying process depends only
on the (euclidean) distance between points, but not on the orientation
or direction of h
. At the other end, an anisotropic
variogram
assumes that the process might depend on the orientation, but not on the
direction. Finally, heat
and perspective
are different
representations of a variogram which assumes that the process depends only on
the absolute distance between rows and columns.
Unless coord
or z
are specified by the user, variogram
builds the variogram with the residuals of the model fit in x
. If
coord
or z
are specified, then the spatial coordinates or the
residuals are respectively overridden.
This function assumes that there is at most one observation per spatial location. Otherwise, are observations measured at different times? should a spatial-temporal variogram be fitted?
print(breedR.variogram)
: Print a breedR variogram
vgram.matrix
data(globulus)
# No spatial effect
res <- remlf90(fixed = phe_X ~ 1,
random = ~ gg,
genetic = list(model = 'add_animal',
pedigree = globulus[, 1:3],
id = 'self'),
data = globulus)
Zd <- model.matrix(res)$genetic
PBV <- Zd %*% ranef(res)$genetic
# variogram() needs coordinates to compute distances
# either you use the \code{coord} argument, or you do:
coordinates(res) <- globulus[, c('x', 'y')]
# there is residual autocorrelation
# there is also spatial structure in the Breeding Values
variogram(res)
variogram(res, z = PBV)
# Autoregressive spatial effect
# eliminates the residual autocorrelation
res.sp<- remlf90(fixed = phe_X ~ 1,
spatial = list(model = 'AR',
coord = globulus[, c('x', 'y')],
rho = c(.9, .9)),
genetic = list(model = 'add_animal',
pedigree = globulus[, 1:3],
id = 'self'),
data = globulus)
Zd <- model.matrix(res.sp)$genetic
PBV <- Zd %*% ranef(res.sp)$genetic
variogram(res.sp)
variogram(res.sp, z = PBV)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.