I was trying to fit the variogram parameters of an empirical variogram using GLS (Generalized Least Squares) fitting method. I used the 'fit.variogram.gls' method of the 'gstat' package in R.
I tried it out by running the example code given in the help document.

coordinates(meuse) = ~x+y
fit.variogram.gls(log(zinc)~1, meuse[1:40,], vgm(1, "Sph", 900,1))

But I was receiving the following error on running the above code :
Error in gamfn(h0, theta) : could not find function "gamfn".

How do I go about interpreting the error and the remedy for it.

1 Answer 1


This was reported as https://github.com/edzer/gstat/issues/33 and fixed at source. Before a new release becomes available, you need to install the package from source:

library(devtools) install_github("edzer/gstat")

Your Answer

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

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