variogram: Empirical variograms of residuals

Description Usage Arguments Details Methods (by generic) See Also Examples

View source: R/variogram.R

Description

Computes isotropic and anisotropic empirical variograms from the residuals of a breedR model.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
variogram(
  x,
  plot = c("all", "isotropic", "anisotropic", "perspective", "heat", "none"),
  R,
  coord,
  z
)

## S3 method for class 'breedR.variogram'
print(x, minN = 30, ...)

Arguments

x

a breedR result.

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 minN pairs of observations are considered unstable and therefore are not plotted. Default: 30.

...

not used.

Details

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?

Methods (by generic)

See Also

vgram.matrix

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
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)

  

famuvie/breedR documentation built on Sept. 6, 2021, 4:50 a.m.