Fits a 2D or 3D variogram model to spatial data

Share:

Description

Fits a 2D or 3D variogram model based on a regression matrix and spatial domain of interest.

Usage

1
2
3
4
5
6
## 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, ...)

Arguments

formulaString

object of class "formula" — regression model

rmatrix

object of class "data.frame"; regression matrix produced as a result of spatial overlay

predictionDomain

object of class "SpatialPixelsDataFrame"; spatial domain of interest

vgmFun

character; variogram function ("Exp" by default)

dimensions

character; "3D", "2D", "2D+T", "3D+T" models

anis

vector containing 2, 5 or more anisotropy parameters; see gstat::vgm for more info

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 gstat::fit.variogram

Details

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).

Author(s)

Tomislav Hengl

See Also

fit.regModel, fit.gstatModel, gstat::fit.variogram

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
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)

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.