Learn R Programming

geoR (version 1.0-0)

olsfit: Variogram Fitting by Ordinary Least Squares

Description

Fits a variogram model to an empirical variogram. Variogram parameters are estimated by ordinary least squares.

Usage

olsfit(vario, ini.cov.pars,
       cov.model = c("exponential", "matern", "gaussian",
                     "spherical", "circular", "cubic", "wave",
                     "powered.exponential", "cauchy", "gneiting",
                     "gneiting.matern", "pure.nugget"),
       fix.nugget = FALSE, nugget = 0, kappa = NULL,
       simul.number = NULL, max.dist = "all",
       minimisation.function = c("optim", "nlm", "nls"), lower = 0,
       messages.screen = TRUE)

Arguments

vario
an object of the class "variogram", typically an output of the function variog. The object is a list with information about the empirical variogram.
ini.cov.pars
initial values for the covariance parameters: $\sigma^2$ (partial sill) and $\phi$ (range parameter). See DETAILS below.
cov.model
a string with the name of the correlation function. For further details see documentation for cov.spatial. Defaults to "exponential".
fix.nugget
logical, indicating whether the parameter $\tau^2$ (nugget variance) should be regarded as fixed (fix.nugget = TRUE) or should be estimated (fix.nugget = FALSE). Defaults to FALSE.
nugget
value for the nugget parameter. Regarded as a fixed values if fix.nugget = TRUE or as a initial value for the minimization algorithm if fix.nugget = FALSE. Defaults to zero.
kappa
fixed value of the smoothness parameter, only required by the following correlation functions: "matern", "powered.exponential", "gneiting" and "gneiting.matern".
simul.number
number of simulation. To be used when the object passed to the argument vario has empirical variograms for more than one data-set (or simulation). Indicates to which one the model will be fitted.
max.dist
maximum distance considered when fitting the variogram. Defaults to vario$max.dist.
minimisation.function
minimization function used to estimate the parameters. Options are "optim", "nlm", "nls". Defaults to "optim".
lower
lower limits for the parameter values. Defaults to zero.
messages.screen
logical. Indicates whether or not status messages are printed on the screen (or other output device) while the function is running.
...
further parameters to be passed to the minimization function. Typically arguments of the type control() which controls the behavior of the minimization algorithm. See documentation for the selected minimization function for furth

Value

  • An object of the class "variomodel" which is list with the following components:
  • nuggetvalue of the nugget parameter. An estimated value if fix.nugget = FALSE or a fixed value if fix.nugget = TRUE.
  • cov.parsa two elements vector with estimated values of the covariance parameters $\sigma^2$ and $\phi$, respectively.
  • cov.modela string with the name of the correlation function.
  • kappafixed value of the smoothness parameter.
  • valueminimized value of the loss function.
  • max.distmaximum distance considered in the variogram fitting.
  • minimisation.functionminimization function used.
  • messagestatus messages returned by the function.
  • methoda string "OLS" indicating the estimation method which was used.
  • callthe function call.

Details

Initial values The algorithms for minimization functions require initial values of the parameters. A unique initial value is used if a vector is provided in the argument ini.cov.pars. The elements are initial values for $\sigma^2$ and $\phi$, respectively. This vector is concatenated with the value of the argument nugget if fix.nugget = FALSE. Specification of multiple initial values is also possible. If this is the case, the function searches for the one which minimizes the loss function and uses this as the initial value for the minimization algorithm. Multiple initial values are specified by providing a matrix in the argument ini.cov.pars and/or, if fix.nugget = FALSE, providing a vector with length greater than one for the argument nugget. If ini.cov.pars is a matrix, the first column has values of $\sigma^2$ and the second has values of $\phi$.

References

Further information about geoR can be found at: http://www.maths.lancs.ac.uk/~ribeiro/geoR.html.

See Also

cov.spatial for a detailed description of the available correlation (variogram) functions, wlsfit for weighted least squares variogram fit, likfit for maximum and restricted maximum likelihood estimation, lines.variomodel for graphical output of the fitted model. For details on the minimization functions see optim, nlm and nls.

Examples

Run this code
if(is.R()) data(s100)
vario100 <- variog(s100, max.dist=1)
ini.vals <- expand.grid(seq(0,1,l=5), seq(0,1,l=5))
ols <- olsfit(vario100, ini=ini.vals, fix.nug=TRUE)
summary(ols)
plot(vario100)
lines(ols)

Run the code above in your browser using DataLab