variofit(vario, ini.cov.pars, cov.model = "matern",
         fix.nugget = FALSE, nugget = 0,
         fix.kappa = TRUE, kappa = 0.5,
         simul.number = NULL, max.dist = "all",
         weights = c("npairs", "equal", "cressie"),
         minimisation.function, messages.screen = TRUE, ...)"variogram", typically an output of the function
    variog. The object is a list with information about the
    empirical variogram.DETAILS below.cov.spatial.
    Defaults are equivalent to the exponential model.fix.nugget = TRUE) or should
    be estimated (fix.nugget = FALSE). Defaults to
    FALSE.fix.nugget = TRUE or as a initial value for the
    minimization algorithm if fix.nugget = FALSE. 
    Defaults to zero.TRUE.fix.kappa = TRUE or as a initial value for the
    minimization algorithm if fix.kappa = FALSE. Only required if
    one of the following correlation functionsvario has empirical variograms for more than one
    data-set (or simulation). Indicates to which one the model will be
    fitted.vario$max.dist.DETAILS below."optim", "nlm".
    If weights = "equal" the option 
    "nls" is also valid and det as default.
    Otherwise defaults to "opcontrol() which controls the
    behavior of the minimization algorithm. See documentation for the 
    selected minimization function for furthclass "variomodel" which is list with the following components:fix.nugget = FALSE or a fixed value if fix.nugget = TRUE.vario.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 and kappa
  if fix.kappa = TRUE.
  
  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, vectors in the arguments 
  nugget and kappa (if included in the estimation).
  If ini.cov.pars is a matrix, the first column has values of
  $\sigma^2$ and the second has values of  $\phi$. 
  
  If minimisation.function = "nls" only the values of
  $\phi$ and $\kappa$ (if this is included in the
  estimation) are used. The remaning are not need by this algorithm.
  
  
  
  Weights
  
  The different options for the argument weights
  are used to define the loss function to be minimised.
  The available options are as follows.
  
  [object Object],[object Object],[object Object],Where $\theta$ is the vector with the variogram parameters
    and
    for each $k^{th}$-bin
    $n_k$ is the number of
    pairs, $(\hat{\gamma}_k)$ is the
    value of the empirical variogram and
    $\gamma_k(\theta)$
    is the value of the theoretical variogram.
    
    See also Cressie (1993) and Barry, Crowder and Diggle (1997) for further discussions on 
    methods to estimate the variogram parameters.  Cressie, N.A.C (1993) Statistics for Spatial Data. New York: Wiley.
  
  Further information about geoR can be found at:
cov.spatial for a detailed description of the
  available correlation (variogram) functions,
  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.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 <- variofit(vario100, ini=ini.vals, fix.nug=TRUE, wei="equal")
summary(ols)
wls <- variofit(vario100, ini=ini.vals, fix.nug=TRUE)
summary(wls)
plot(vario100)
lines(wls)
lines(ols, lty=2)
<testonly>vr <- variog(s100, max.dist=1)
## OLS#
o1 <- variofit(vr, ini = c(.5, .5), fix.nug=TRUE, wei = "equal")
o2 <- variofit(vr, ini = c(.5, .5), wei = "equal")
o3 <- variofit(vr, ini = c(.5, .5), fix.nug=TRUE,
      fix.kappa = FALSE, wei = "equal")
o4 <- variofit(vr, ini = c(.5, .5), fix.kappa = FALSE, wei = "equal")
## WLS
w1 <- variofit(vr, ini = c(.5, .5), fix.nug=TRUE)
w2 <- variofit(vr, ini = c(.5, .5))
w3 <- variofit(vr, ini = c(.5, .5), fix.nug=TRUE, fix.kappa = FALSE)
w4 <- variofit(vr, ini = c(.5, .5), fix.kappa = FALSE)</testonly>Run the code above in your browser using DataLab