fit.vgmModel: Fits a 2D or 3D variogram model to spatial data

Description Usage Arguments Details Author(s) See Also Examples

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)

Example output

GSIF version 0.5-5.1 (2019-01-04)
URL: http://gsif.r-forge.r-project.org/
Warning message:
In showSRID(uprojargs, format = "PROJ", multiline = "NO", prefer_proj = prefer_proj) :
  Discarded datum Amersfoort in CRS definition
Warning messages:
1: In proj4string(predictionDomain) :
  CRS object has comment, which is lost in output
2: In proj4string(predictionDomain) :
  CRS object has comment, which is lost in output

GSIF documentation built on May 2, 2019, 5:44 p.m.

Related to fit.vgmModel in GSIF...