Fitting variograms

Overview

Fitting theoretical variograms to empirical observations is an important modeling step to ensure valid mathematical models of spatial continuity. Given an empirical variogram, the fit function can be used to perform the fit:

StatsBase.fitMethod
fit(V, γ, [algo])
fit(V, γ, [weigthfun])

Fit theoretical variogram type V to empirical variogram γ using algorithm algo. Default algorithm is WeightedLeastSquares.

Alternatively pass the weighting function weightfun directly to the fitting procedure.

fit(Variogram, γ, [algo])
fit(Variogram, γ, [weightfun])

Fit all subtypes of Variogram to empirical variogram γ and return the one with minimum error as defined by the algorithm algo.

Alternatively pass the weighting function weightfun directly to the fitting procedure.

Example

# sinusoidal data
𝒟 = georef((Z=[sin(i/2) + sin(j/2) for i in 1:50, j in 1:50],))

# empirical variogram
g = EmpiricalVariogram(𝒟, :Z, maxlag=25.)

plot(g)

We can fit specific models to the empirical variogram:

γ = fit(SineHoleVariogram, g)

plot(g); plot!(γ)

or let GeoStats.jl find the model with minimum error:

γ = fit(Variogram, g)

plot(g); plot!(γ)

which should be a SineHoleVariogram given that the synthetic data of this example is sinusoidal.

Optionally, we can specify a weighting function to give different weights to the lags:

γ = fit(SineHoleVariogram, g, h -> exp(-h))

plot(g); plot!(γ)

Methods

Weighted least squares

Variography.WeightedLeastSquaresType
WeightedLeastSquares()
WeightedLeastSquares(w)

Fit theoretical variogram using weighted least squares with weighting function w (e.g. h -> 1/h). If no weighting function is provided, bin counts of empirical variogram are normalized and used as weights.