I am trying to perform a kriging interpolation. But when it comes to the point when i want to fit the variogram to the model I get the following warning: In fit.variogram(vario, vgm("Sph")) : singular model in variogram fit

I am not sure where I have to look at to solve the porblem.

my data (these are just 10 / 216 lines):


my code:


WU_data <- read.csv(file = "./WU_Data.csv", header = TRUE, sep = ";")
WU_data <- WU_data[complete.cases(WU_data),]

min_lon <- min(WU_data$Longitude)
max_lon <- max(WU_data$Longitude)
min_lat <- min(WU_data$Latitude)
max_lat <- max(WU_data$Latitude)

Longitude.range <- as.numeric(c(min_lon,max_lon))
Latitude.range <- as.numeric(c(min_lat,max_lat))

grd <- expand.grid(Longitude = seq(from = Longitude.range[1], to = Longitude.range[2], by = 0.1), 
                   Latitude = seq(from = Latitude.range[1],to = Latitude.range[2], by = 0.1))  # expand points to grid
coordinates(grd) <- ~Longitude + Latitude
gridded(grd) <- TRUE

WU_data_spatial <- WU_data
coordinates(WU_data_spatial) = ~Longitude + Latitude

vario <-  variogram(Temperature ~1, WU_data_spatial)
vario.fit <- fit.variogram(vario, vgm("Sph"))


enter image description here

  • Its a warning so it might not be a problem. What does the variogram look like when you plot it? What does the fitted variogram look like? Maybe you need to adjust the bins of your variogram? Maybe there's just no spatial correlation in the data? (Bonus maybe: maybe you should convert your lat-long to something cartesian)
    – Spacedman
    Commented Jan 27, 2017 at 8:29
  • 3
    There's a paragraph starting "On singular model fits..." in the "Note:" section of help(fit.variogram) which you should read.
    – Spacedman
    Commented Jan 27, 2017 at 8:32
  • That's a nice looking variogram - you might even want to go out to a further distance to see if it levels off. Is it anywhere near var(W_data_spatial$Temperature) yet? And what does the fitted variogram model look like on top of that and what do the parameters look like? Show us the vario.fit object.
    – Spacedman
    Commented Jan 31, 2017 at 7:53
  • Is it possible that you have multiple data rows for the same coordinates?
    – David
    Commented Oct 31, 2019 at 11:01

1 Answer 1


Some has already been said by Spacedman in the comments. This warning may not pose a problem, if the variogram looks good. A good option might be to initialize some of the variogram parameters in vgm("Sph"). I usually take these values as default:

vario <-  variogram(Temperature ~1, WU_data_spatial)
vario.fit <- fit.variogram(vario, vgm(psill=max(vario$gamma)*0.9, model = "Sph", range=max(vario$dist)/2, nugget = mean(vario$gamma)/4))

and change them (or set some of them to NA) until I reach a satisfying result. Although I don't have so much experience as to demonstrate it in this particular case. Also the results would differ on this small sample of data and the whole dataset, on which you may achieve a better fit.

Personally, I would use the package automap and the function autofitVariogram to do this.


vario.fit = autofitVariogram(Temperature~1,
                             model = c("Sph"),
                             kappa = c(0.05, seq(0.2, 2, 0.1), 5, 10),
                             fix.values = c(NA, NA, NA),
                             start_vals = c(NA,NA,NA),
                             verbose = T)

plot(vario, vario.fit$var_model, main = "Fitted variogram")

Which gives the following result: Variogram fitted using autofitVariogram

Looking at the dots of the empirical variogram I would think that the spatial correlation is rather poor, but again - I don't feel experienced enough to make any conclusions.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.