gv.model {phylin} | R Documentation |
Fit a model to the semi-variogram.
Description
Fits a model to a semi-variogram contructed with
gen.variogram
. Parameters for each model are estimated by
nonlinear least squares.
Usage
gv.model(gv, model='spherical', sill = NA, range=NA, nugget = 0,
ctrl=nls.control())
Arguments
gv |
'gv' object from the |
model |
Model to fit the data. Available models are spherical (default), gaussian, exponential or linear. See details. |
sill |
The heigth (semi-variance) of the model when it stabilizes. Defaults to NA. |
range |
The length (real distance) where stabilization occurs. Defaults to NA. |
nugget |
Intercept in the y-axis. Defaults to 0. |
ctrl |
Nls control object for the fitting procedure. (check ?nls.control for more details). |
Details
This function fits a model to the data, either by estimating the model parameters using nonlinear least squares or by user provided values. Notice that parameters with NA will be estimated by the nls function and parameters with values given are not estimated (by default, the nugget is not estimated and set to zero). The variogram model can be plotted using 'plot' function or used to predict to a new set of values using 'predict'. It is used to define weights for the krigging interpolation.
The parameters of the semi-variogram model (\gamma
) are the
distance (h
), range (a
), sill (c = c_0 + c_1
;
where c_1
is the partial sill), and nugget
(c_0
).
The models available are:
gaussian:
\gamma(h) = c_0 + c_1 \left(1-exp\left(-3\frac{h^2} {a^2}\right)\right)
exponential:
\gamma(h) = c_0 + c_1 \left(1-exp\left(-\frac{3h}{a} \right)\right)
spherical:
\gamma(h) = \left\{ \begin{array}{ll} c_0 + c_1\left(\frac{3}{2}\frac{h}{a} - \frac{1}{2}(\frac{h}{a})^3\right) & 0 < h \le a \\ c & h > a \end{array}\right.
pentaspherical:
\gamma(h) = \left\{ \begin{array}{ll} c_0 + c_1\left(\frac{15}{8}\frac{h}{a} - \frac{5}{4}(\frac{h}{a})^3 + \frac{3}{8}(\frac{h}{a})^5\right) & 0 < h \le a \\ c & h > a \end{array}\right.
cubic:
\gamma(h) = \left\{ \begin{array}{ll} c_0 + c_1\left(7(\frac{h}{a})^2 - \frac{35}{4}(\frac{h}{a})^3 + \frac{7}{2}(\frac{h}{a})^5 - \frac{3}{4}(\frac{h}{a})^7\right) & 0 < h \le a \\ c & h > a \end{array}\right.
linear:
\gamma(h) = \left\{ \begin{array}{ll} c_0 + \left(\frac{c_1}{a}h\right) & 0 < h \le a \\ c & h > a \end{array}\right.
Value
Returns a 'gv' object with the model, input data, and parameter values.
Author(s)
Pedro Tarroso <ptarroso@cibio.up.pt>
References
Fortin, M. -J. and Dale, M. (2006) Spatial Analysis: A guide for Ecologists. Cambridge: Cambridge University Press.
Isaaks, E. H. and Srivastava, R. M. (1989) An Introduction to applied geostatistics. New York: Oxford University Press.
Legendre, P. and Legendre, L. (1998) Numerical ecology. 2nd english edition. Amesterdam: Elsevier
See Also
Examples
data(vipers)
data(d.gen)
# create a distance matrix between samples
r.dist <- dist(vipers[,1:2])
# fit a variogram with defaults (shperical model) and estimation of range
gv <- gen.variogram(r.dist, d.gen)
gv <- gv.model(gv)
# plot variogram
plot(gv)
# fit a new variogram with linear with sill model and range 8
gv2 <- gv.model(gv, model='linear', range=8)
plot(gv2)