Variogram.gls {nlme} | R Documentation |
Calculate Semi-variogram for Residuals from a gls Object
Description
This method function calculates the semi-variogram for the residuals
from a gls
fit. The semi-variogram values are calculated for
pairs of residuals within the same group level, if a grouping factor
is present. If collapse
is different from "none"
, the
individual semi-variogram values are collapsed using either a robust
estimator (robust = TRUE
) defined in Cressie (1993), or the
average of the values within the same distance interval. The
semi-variogram is useful for modeling the error term correlation
structure.
Usage
## S3 method for class 'gls'
Variogram(object, distance, form, resType, data,
na.action, maxDist, length.out, collapse, nint, breaks,
robust, metric, ...)
Arguments
object |
an object inheriting from class |
distance |
an optional numeric vector with the distances between
residual pairs. If a grouping variable is present, only the
distances between residual pairs within the same group should be
given. If missing, the distances are calculated based on the
values of the arguments |
form |
an optional one-sided formula specifying the covariate(s)
to be used for calculating the distances between residual pairs and,
optionally, a grouping factor for partitioning the residuals (which
must appear to the right of a |
resType |
an optional character string specifying the type of
residuals to be used. If |
data |
an optional data frame in which to interpret the variables
in |
na.action |
a function that indicates what should happen when the
data contain |
maxDist |
an optional numeric value for the maximum distance used for calculating the semi-variogram between two residuals. By default all residual pairs are included. |
length.out |
an optional integer value. When |
collapse |
an optional character string specifying the type of
collapsing to be applied to the individual semi-variogram values. If
equal to |
nint |
an optional integer with the number of intervals to be
used when collapsing the semi-variogram values. Defaults to |
robust |
an optional logical value specifying if a robust
semi-variogram estimator should be used when collapsing the
individual values. If |
breaks |
an optional numeric vector with the breakpoints for the
distance intervals to be used in collapsing the semi-variogram
values. If not missing, the option specified in |
metric |
an optional character string specifying the distance
metric to be used. The currently available options are
|
... |
some methods for this generic require additional arguments. None are used in this method. |
Value
a data frame with columns variog
and dist
representing,
respectively, the semi-variogram values and the corresponding
distances. If the semi-variogram values are collapsed, an extra
column, n.pairs
, with the number of residual pairs used in each
semi-variogram calculation, is included in the returned data frame. If
object
includes a corSpatial
element, a data frame with
its corresponding semi-variogram is included in the returned value, as
an attribute "modelVariog"
. The returned value inherits from
class Variogram
.
Author(s)
José Pinheiro and Douglas Bates bates@stat.wisc.edu
References
Cressie, N.A.C. (1993), "Statistics for Spatial Data", J. Wiley & Sons.
See Also
gls
,
Variogram
,
Variogram.default
,
Variogram.lme
,
plot.Variogram
Examples
fm1 <- gls(weight ~ Time * Diet, BodyWeight)
Vm1 <- Variogram(fm1, form = ~ Time | Rat)
print(head(Vm1), digits = 3)