Skip to main content
v2026.11,986 entries · CC-BY 4.0

Variogram: Nugget, Sill, Range and How to Fit One in R/Python

What a variogram shows, how to fit one in R gstat or Python scikit-gstat, and how to read nugget, sill and range.

Written and maintained by CASRAI Editorial Board

Published

On this page

A variogram (also called a semivariogram) is a plot of how different pairs of measurements are as a function of the distance between them, and it is the model input that geostatistical interpolation such as kriging needs. In practice you compute an empirical variogram from your sampled points, fit a theoretical model to it, and read three parameters off the fitted curve: the nugget, the sill and the range. This guide shows the commands for doing that in the free R package gstat and the free Python package scikit-gstat, and how to read and troubleshoot the output.

What a variogram is used for in research

Spatial measurements taken close together tend to be more alike than measurements taken far apart. A variogram quantifies that pattern. Researchers use it to describe the scale over which a variable (soil metal concentration, rainfall, groundwater level) is spatially autocorrelated, and to supply the fitted model that kriging uses to weight neighbouring samples. In the gstat documentation the plotted quantity on the vertical axis is the semivariance, called gamma in the output, so “variogram” and “semivariogram” refer to the same display in these tools.

A variogram answers a different question from a single-number spatial statistic. Moran’s I summarises global spatial autocorrelation in one value; the variogram shows how that dependence changes with distance. For the wider workflow see the spatial data analysis guide; for a point-and-click route to related spatial statistics see GeoDa.

The three parameters: nugget, sill and range

Esri’s Geostatistical Analyst documentation (read 2026-11-13) defines the parameters on a fitted semivariogram model:

  • Range: “The distance where the model first levels out is known as the range.” Locations closer together than the range are spatially autocorrelated.
  • Sill: the value the model attains at the range.
  • Partial sill: the sill minus the nugget.
  • Nugget: in theory the semivariogram is 0 at zero separation distance, but it often shows a positive value, the nugget effect. Esri attributes this to measurement error and to variation at scales finer than the sampling interval.

scikit-gstat (user guide, read 2026-11-13) describes the nugget as “the semi-variance modeled on the 0-distance lag” and uses a stated convention for range: the distance at which 95% of the sill is approached is its effective range. When you compare ranges between software packages, check which definition each one reports.

Install or access

Both tools below are open-source and documented on their own project sites; use those as the reference for installation and version-specific behaviour.

  • R, gstat: install the gstat package from CRAN in the usual way, then load it with library(gstat). Reference pages for variogram(), fit.variogram() and vgm() are at r-spatial.github.io/gstat/reference/.
  • Python, scikit-gstat: imported as import skgstat as skg. The user guide is at scikit-gstat.readthedocs.io.

Step-by-step: fit a variogram in R with gstat

The gstat reference pages use the meuse soil dataset (zinc concentration in a Meuse river floodplain) for their examples. The steps below follow that example.

  1. Load the data and declare coordinates. library(sp), data(meuse), then coordinates(meuse) = ~x+y.
  2. Compute the empirical variogram. vgm1 <- variogram(log(zinc)~1, meuse). The formula log(zinc)~1 models the log of zinc as a constant mean. The result is a data frame of class gstatVariogram.
  3. Choose a starting model. vgm(1, "Sph", 300, 1) creates a model with partial sill 1, spherical type, range 300 and nugget 1. Running vgm() with no arguments prints the table of available model types. Passing a vector such as vgm(c("Mat","Sph")) supplies a candidate list.
  4. Fit the model. fit.variogram(vgm1, vgm(1,"Sph",300,1)) adjusts the sill and range (fit.sills=TRUE, fit.ranges=TRUE by default) to the empirical estimates. If you pass a model with NA start values, gstat starts the range at one third of the maximum distance, the nugget at the mean of the first three gamma values and the partial sill at the mean of the last five.
  5. Inspect and plot. Print the fitted object, and plot the empirical variogram with the fitted line to check the fit visually before using it for interpolation.

Controlling the distance bins

Two arguments set how point pairs are grouped. cutoff is the spatial separation distance up to which pairs are included in the semivariance estimates; its default is the diagonal of the data bounding box divided by 3. width is the width of the successive distance intervals; its default is cutoff/15. Setting cloud=TRUE returns the variogram cloud (one point per pair, class variogramCloud) instead of binned estimates, and cressie=TRUE switches from the classical method-of-moments estimator to Cressie’s robust estimator.

Step-by-step: fit a variogram in Python with scikit-gstat

  1. Import the package: import skgstat as skg.
  2. Create the variogram from coordinates and values: V = skg.Variogram(coords, values). Options include n_lags, maxlag, bin_func, model, estimator, normalize, dist_func (default 'euclidean') and fit_method ('trf' by default, or 'lm').
  3. Choose an estimator and model. The documented estimators are matheron (default), cressie, dowd and genton (slow). The documented models are spherical (described as the most common), exponential, gaussian and matern.
  4. Read the results: V.describe() returns a dictionary that includes the model, estimator, effective range, sill, nugget and fitted parameters.
  5. Plot: V.plot(axes=ax, hist=False) draws the empirical points and the fitted model on a matplotlib axis.

R and Python arguments side by side

The two packages expose the same ideas under different argument names. The data table below maps them, with each entry taken from the packages’ own documentation.

Output and how to read it

The empirical variogram table (gstat)

The object returned by variogram() has one row per distance bin with three key columns: np (the number of point pairs behind that estimate), dist (the mean distance of those pairs) and gamma (the semivariance estimate). A bin with a small np is a less reliable estimate than one built from many pairs, so look at np before trusting a wiggle in the curve.

The fitted model (gstat meuse example)

The gstat reference page for fit.variogram() shows this result for the log-zinc example with a spherical model:

  model     psill    range
1   Nug 0.05065547   0.0000
2   Sph 0.59060085 896.9719

Reading it: the nugget (Nug) is about 0.051, the spherical partial sill is about 0.591, and the range is about 897 distance units. The sill is the nugget plus the partial sill, about 0.641. The same page shows a Matérn fit with fit.kappa=TRUE returning a nugget of 0.089, a partial sill of 0.578, a range of 221.5 and kappa 1.3, which illustrates that different model families give different parameter values for the same empirical variogram, so compare fits, not just numbers.

The fitted model object

fit.variogram() returns a variogramModel with two attributes worth checking: singular and SSErr (the fit error reported by gstat).

Troubleshooting

  • singular is TRUE. gstat documents this attribute as flagging a singularity: the fit did not converge. Try different start values, a different model type, or a different cutoff.
  • Surprising fit because of default bins. If the curve looks too noisy or too smooth, check the defaults (cutoff = bounding-box diagonal / 3, width = cutoff/15) and set them explicitly for your study area.
  • Unstable estimates in some bins. Look at np; consider fewer or wider bins, or the robust estimator (cressie=TRUE in gstat, estimator='cressie' in scikit-gstat).
  • Different weighting gives different parameters. fit.variogram() defaults to fit.method = 7, which weights bin j by N_j / h_j², where N_j is the number of pairs and h_j the bin distance. Method 1 weights by N_j, method 2 by N_j / gamma(h_j)², and method 6 is unweighted ordinary least squares. State the method you used when you report results.
  • Ranges that do not match between packages. scikit-gstat reports an effective range at 95% of the sill; confirm the convention before comparing it to a range from another tool.

Free alternatives

Tool Language Variogram functions Documentation
gstat R variogram(), fit.variogram(), vgm() r-spatial.github.io/gstat
scikit-gstat Python skgstat.Variogram, describe(), plot() scikit-gstat.readthedocs.io

Esri’s Geostatistical Analyst in ArcGIS Pro also fits semivariograms and publishes a useful explanation of range, sill and nugget, cited above; this guide does not cover its menus.

FAQ

Is a variogram the same as a semivariogram?

In the documentation used for this guide, the plotted quantity is the semivariance (gamma), and the displays are called variograms in gstat and semivariograms in Esri’s documentation. You can treat the terms as referring to the same plot.

What do nugget, sill and range mean?

The range is the distance at which the fitted model first levels out, the sill is the value the model reaches at that range, and the nugget is the non-zero value at zero separation, attributed to measurement error and variation at finer scales than the sampling interval.

Which model should I fit?

Both packages offer several model families (gstat lists them with vgm(); scikit-gstat documents spherical, exponential, gaussian and matern). The spherical model is described in the scikit-gstat guide as the most common. Compare candidate fits with SSErr and visual inspection rather than relying on one default.

Why does gstat report singular = TRUE?

It means the fitting procedure hit a singularity and did not converge. Change the start values, model or cutoff and refit.

How is a variogram used in kriging?

The fitted variogram model supplies the spatial dependence structure that kriging uses to weight neighbouring observations when predicting at unsampled locations. See the kriging guide for the interpolation step.

Sources

  • gstat, variogram() reference. r-spatial.github.io/gstat/reference/variogram.html (read 2026-11-13)
  • gstat, fit.variogram() reference. r-spatial.github.io/gstat/reference/fit.variogram.html (read 2026-11-13)
  • gstat, vgm() reference. r-spatial.github.io/gstat/reference/vgm.html (read 2026-11-13)
  • scikit-gstat user guide, Variogram. scikit-gstat.readthedocs.io/en/latest/userguide/variogram.html (read 2026-11-13)
  • Esri, ArcGIS Pro Geostatistical Analyst: Understanding a semivariogram, the range, sill, and nugget. doc.esri.com/en/arcgis-pro/latest/help/analysis/geostatistical-analyst/understanding-a-semivariogram-the-range-sill-and-nugget.html (read 2026-11-13)

Data: Variogram argument crosswalk: R gstat versus Python scikit-gstat

Side-by-side mapping of variogram settings (distance limits, binning, estimator, model, fitting method, outputs, range convention) between the R package gstat and the Python package scikit-gstat, compiled from each package's own reference documentation, read 2026-11-13.

Variogram argument crosswalk: R gstat versus Python scikit-gstat
SettingR gstatPython scikit-gstatNote
Maximum pair distancecutoff (default: bounding-box diagonal / 3)maxlagR: distance up to which pairs are included; Python: maximum lag distance option
Bin definitionwidth (default: cutoff/15)n_lags, bin_funcR sets bin width; Python sets number of lags and binning function
Robust estimatorcressie = TRUEestimator = 'cressie'Default in R is the classical method-of-moments estimator; default in Python is matheron
Model typevgm(psill, model, range, nugget): Sph, Exp, Gau, Matmodel: spherical, exponential, gaussian, maternShort names in R, full names in Python
Fitting methodfit.method = 7 (default)fit_method = 'trf' (default) or 'lm'Different algorithms and weighting options; results can differ
Fit summarysingular and SSErr attributesV.describe()R flags non-convergence; Python returns model, estimator, effective range, sill, nugget
Range definitionrange parameter of the modeleffective_range at 95% of sillCheck the convention before comparing ranges across tools

Sources

Compiled by CASRAI from the sources above. Free to reuse under CC BY 4.0 with attribution.

Follow CASRAI

Research-administration guidance, standards updates and independent tool reviews.

Ask CASRAI · full access

Ask about Variogram: Nugget, Sill, Range and How to Fit One in R/Python

Full access: large monthly usage, up to 10 source passages behind each answer, and MCP and API access for Claude Code, Codex and other CLIs. Cancel any time.

An AI assistant for research: funder rules, compliance, methods and publishing. It links the sources behind its answers and labels answers that come from a web search.

Answers draw on CASRAI's guides and dictionary plus the federal and funder documents we index: Federal Register, Grants.gov, Regulations.gov and UKRI.

Works on this site and inside Claude, Cursor and the AI tools you already use.

Everything CASRAI publishes — this page, the dictionary, the guides and the news — stays open to read, with no account and no card.

Referenced across the research world

University of Cambridge logoColumbia University logoCrossref logoUniversity of Edinburgh logoHarvard University logoUniversity of Oxford logoPrinceton University logoStanford School of Medicine logoUniversity College London logoORCID logoUniversity of Cambridge logoColumbia University logoCrossref logoUniversity of Edinburgh logoHarvard University logoUniversity of Oxford logoPrinceton University logoStanford School of Medicine logoUniversity College London logoORCID logo
  • University of Cambridge logo
  • Columbia University logo
  • Crossref logo
  • University of Edinburgh logo
  • Harvard University logo
  • University of Oxford logo
  • Princeton University logo
  • Stanford School of Medicine logo
  • University College London logo
  • ORCID logo

View CASRAI adoption →