Display a Variogram Object and Theoretical Model

DESCRIPTION:

Plots an empirical variogram object and displays the fit of a theoretical variogram model on that plot. Optionally allows interactive parameter updates to the theoretical model and displays the new fit.

USAGE:

model.variogram(object, fun, ..., ask=T, objective.fun=<<see below>>,  
                plot.it=T) 

REQUIRED ARGUMENTS:

object
an object that inherits from class "variogram" (this includes classes "covariogram" and "correlogram"). The azimuth column should have only one level.
fun
a theoretical variogram function (or covariogram or correlogram function, depending on the class of "object"). Its first argument should be distance. Its remaining arguments are considered parameters that can be changed to update the fit of fun to object.

OPTIONAL ARGUMENTS:

...
additional arguments to fun that do not have default values must be specified here by full name.
ask
a logical value, if TRUE, a command line menu is displayed allowing the user to change the values of the parameters to fun. After changing a value the plot is updated. If FALSE, the data in object is plotted, the value of fun evaluated at object$distance is added to the graph, and the function returns.
objective.fun
a function with three arguments, y, yf, and n that gives a measure of the fit of yf to y with weights n. It is used as a measure of fit of fun to the data in object. The default is the sum of squared residuals, sum((y-yf)^2).
plot.it
a logical value, if TRUE, a plot of the variogram and its fitted model is displayed.

VALUE:

invisibly returns a named list of the final parameters used. This list has the last value of the objective function as an attribute.

DETAILS:

This function can be used to fit a variogram or covariogram model "by eye". The value of objective.fun is displayed on the plot.

A weighted least squares objective function for variograms (Cressie, 1993, p. 97) is:

objective.fun <- function(y,yh,n) sum(n*(y/yh-1)^2)

REFERENCES:

Cressie, Noel. (1993). Statistics For Spatial Data, Revised Edition. Wiley, New York.

SEE ALSO:

, , .

EXAMPLES:

vg.iron <- variogram(residuals ~ loc(easting, northing), data=iron.ore) 
model.variogram(vg.iron, spher.vgram, range=8.7, sill=3.5, nugget=4.8)