| fit.vgmModel-methods {GSIF} | R Documentation | 
Fits a 2D or 3D variogram model based on a regression matrix and spatial domain of interest.
## S4 method for signature 'formula,data.frame,SpatialPixelsDataFrame'
fit.vgmModel(formulaString,
      rmatrix, predictionDomain, vgmFun = "Exp", 
      dimensions = list("2D", "3D", "2D+T", "3D+T"),
      anis = NULL, subsample = nrow(rmatrix), ivgm, cutoff = NULL,
      width, cressie = FALSE, ...)
| formulaString | object of class  | 
| rmatrix | object of class  | 
| predictionDomain | object of class  | 
| vgmFun | character; variogram function ( | 
| dimensions | character;  | 
| anis | vector containing 2, 5 or more anisotropy parameters; see  | 
| subsample | integer; size of the subset | 
| ivgm | vgm; initial variogram model | 
| cutoff | numeric; distance up to which point pairs are included in semivariance estimates | 
| width | numeric; sample variogram bin width | 
| cressie | logical; specifies whether to use cressie robust estimator | 
| ... | other optional arguments that can be passed to  | 
It will try to fit a variogram to multidimensional data. If the data set is large, this process can be time-consuming, hence one way to speed up fitting is to subset the regression matrix using the subsample argument (i.e. randomly subset observations).
Tomislav Hengl
fit.regModel, fit.gstatModel, gstat::fit.variogram 
library(sp) library(gstat) ## fit variogram to the Meuse data: demo(meuse, echo=FALSE) # produce a regression matrix: ov <- over(meuse, meuse.grid) ov <- cbind(data.frame(meuse["om"]), ov) # fit a model: v <- fit.vgmModel(om~1, rmatrix=ov, meuse.grid, dimensions="2D") plot(variogram(om ~ 1, meuse[!is.na(meuse$om),]), v$vgm)