Learn R Programming

geoR (version 1.7-5.2.1)

lines.variomodel: Adds a Line with a Variogram Model to a Variogram Plot

Description

This function adds a line with a variogram model specifyed by the user to a current variogram plot. The variogram is specifyed either by passing a list with values for the variogram elements or using each argument in the function.

Usage

# S3 method for variomodel
lines(x, …)
# S3 method for default
lines.variomodel(x, cov.model, cov.pars, nugget, kappa,
                          max.dist, scaled = FALSE, …)

Arguments

x

a list with the values for the following components: cov.model, cov.pars, nugget, kappa , max.dist; or a numeric vector with values for x-axis values for the variogram (distances). This argument is not required if the other arguments in the function are provided, otherwise is compulsory. If a list is provided the arguments which match the list elements are ignored.

cov.model

a string with the type of the variogram function. See documentation of cov.spatial for further details.

cov.pars

a vector or matrix with the values for the partial sill (\(\sigma^2\)) and range (\(\phi\)) parameters.

nugget

a scalar with the value of the nugget (\(\tau^2\)) parameter.

kappa

a scalar with the value of the smoothness (\(\kappa\)) parameters. Only required if cov.model is one of the following: "matern", "powered.exponential", "cauchy" and "gneiting.matern"

max.dist

maximum distance (x-axis) to compute and draw the line representing the variogram model. If a list is provided in x the default is the distance given by x$max.dist. If a vector is provided in x it takes max(x).

scaled

logical. If TRUE the total sill in the plot is equals to \(1\).

arguments to be passed to the function curve.

Value

A line with a variogram model is added to a plot on the current graphics device. No values are returned.

Details

Adds a line with a variogram model to a plot. In conjuction with plot.variogram can be used for instance to compare sample variograms against fitted models returned by variofit and/or likfit.

References

Further information on the package geoR can be found at: http://www.leg.ufpr.br/geoR.

See Also

lines.variomodel.krige.bayes, lines.variomodel.grf, lines.variomodel.variofit, lines.variomodel.likGRF, plot.variogram, lines.variogram, variofit, likfit, curve.

Examples

Run this code
# NOT RUN {
# computing and ploting empirical variogram
vario <- variog(s100, max.dist = 1)
plot(vario)
# estimating parameters by weighted least squares
vario.wls <- variofit(vario, ini = c(1, .3), fix.nugget = TRUE)
# adding fitted model to the plot  
lines(vario.wls)
#
# Ploting different variogram models
plot(0:1, 0:1, type="n")
lines.variomodel(cov.model = "exp", cov.pars = c(.7, .25), nug = 0.3, max.dist = 1) 
# an alternative way to do this is:
my.model <- list(cov.model = "exp", cov.pars = c(.7, .25), nugget = 0.3,
max.dist = 1) 
lines.variomodel(my.model, lwd = 2)
# now adding another model
lines.variomodel(cov.m = "mat", cov.p = c(.7, .25), nug = 0.3,
                 max.dist = 1, kappa = 1, lty = 2)
# adding the so-called "nested" models
# two exponential structures
lines.variomodel(seq(0,1,l=101), cov.model="exp",
                 cov.pars=rbind(c(0.6,0.15),c(0.4,0.25)), nug=0, col=2)
## exponential and spherical structures
lines.variomodel(seq(0,1,l=101), cov.model=c("exp", "sph"),
                 cov.pars=rbind(c(0.6,0.15), c(0.4,0.75)), nug=0, col=3)
# }

Run the code above in your browser using DataLab