[R-sig-Geo] Warning in fit.variogram: value out of range in 'bessel k' | automap and gstat packages

Frederico Faleiro |v|@|e|ro @end|ng |rom gm@||@com
Mon Sep 16 17:06:13 CEST 2019


Hi Jon and others,

thank you. Apparently the gstat have the capacity to fit the parameters
only specifing the variogram model (
https://www.r-spatial.org/r/2016/02/14/gstat-variogram-fitting.html), but I
imagine there is a limitation to search for the correct parameters.
Then it is better when we provide some initial values for help in this
process as the autofitVariogram perform.

Best regards,

Frederico

On Mon, Sep 16, 2019 at 6:11 AM <Jon.SKOIEN using ec.europa.eu> wrote:

> Hi Frederico,
>
>
> gstat does not have different behaviour, because autofitVariogram is using
> fit.variogram, after some preprocessing. You get the convergency problems
> with fit.variogram because you don't supply start values for the variogram,
> which is done in the preprocessing of autofitVariogram.
>
>
> Cheers,
>
> Jon
>
>
> --
> Jon Olav Skøien
> European Commission
> Joint Research Centre – JRC.E.1
> Disaster Risk Management Unit
> Building 26b 1/144 | Via E.Fermi 2749, I-21027 Ispra (VA) Italy, TP 267
> jon.skoien using ec.europa.eu <https://remi.webmail.ec.europa.eu/owa/redir.aspx?C=O12RUARdbvGA3WF3zGoSV0j5xMoZlQcIEwiS4Y9G8jzXRqCCC1HUCA..&URL=mailto%3ajon.skoien%40jrc.ec.europa.eu> Tel:  +39 0332 789205 Disclaimer: Views expressed in this email are those of the individual and do not necessarily represent official views of the European Commission.
>
>
> ------------------------------
> *From:* Frederico Faleiro <fvfaleiro using gmail.com>
> *Sent:* 13 September 2019 23:16:22
> *To:* SKOIEN Jon (JRC-ISPRA)
> *Cc:* RsigGeo
> *Subject:* Re: [R-sig-Geo] Warning in fit.variogram: value out of range
> in 'bessel k' | automap and gstat packages
>
> Hi Jon and others,
>
> thank you for your help. The problem is really in the Ste model (Matern,
> M. Stein's parameterization). The warning only happens
> when I execute this model. However in the gstat with the same parameters
> for lambda have problem of convergency. Do you think the gstat have
> different bevavior to the same issue?
>
> av <- autofitVariogram(jan~1, pr, model = "Ste", verbose = T)
> # In fit.variogram(experimental_variogram, model = vgm(psill = psill,
>  ... :  value out of range in 'bessel_k'
>
> # define the same kappa values of automap
> seq.k <- c(0.05, seq(0.2, 2, 0.1), 5, 10)
> ve <- variogram(jan~1, pr)
> v <- fit.variogram(v, vgm("Ste"), fit.kappa = seq.k)
> Warning messages:
> 1: In fit.variogram(object, model, fit.sills = fit.sills, fit.ranges =
> fit.ranges,  :
>   No convergence after 200 iterations: try different initial values?
> 2: In fit.variogram(object, model, fit.sills = fit.sills, fit.ranges =
> fit.ranges,  :
>   No convergence after 200 iterations: try different initial values?
> 3: In fit.variogram(o, m, fit.kappa = FALSE, fit.method = fit.method,  :
>   No convergence after 200 iterations: try different initial values?
>
>
> Best regards,
>
> Frederico
>
> On Wed, Sep 11, 2019 at 7:02 AM <Jon.SKOIEN using ec.europa.eu> wrote:
>
>>
>> Frederico,
>>
>>
>> I don't think you need to worry about this warning in this case.
>> autofitVariogram tests a lot of variogram models (and different
>> kappa-values) in the search for the best one, and then fit.variogram tries
>> to optimize the parameters based on these. It seems the warnings were
>> generated in the C-code of gstat, based on some of the tested kappa-values
>> for the Matern variogram (Stein implementation). It also seems that these
>> kappa values did not give good fits to the sample variogram, so you did not
>> get the warning from the best fit variogram in this case.
>>
>>
>> Hope this helps,
>>
>> Jon
>>
>>
>>
>> --
>> Jon Olav Skøien
>> European Commission
>> Joint Research Centre – JRC.E.1
>> Disaster Risk Management Unit
>> Building 26b 1/144 | Via E.Fermi 2749, I-21027 Ispra (VA) Italy, TP 267
>> jon.skoien using ec.europa.eu <https://remi.webmail.ec.europa.eu/owa/redir.aspx?C=O12RUARdbvGA3WF3zGoSV0j5xMoZlQcIEwiS4Y9G8jzXRqCCC1HUCA..&URL=mailto%3ajon.skoien%40jrc.ec.europa.eu> Tel:  +39 0332 789205 Disclaimer: Views expressed in this email are those of the individual and do not necessarily represent official views of the European Commission.
>>
>>
>> ------------------------------
>> *From:* R-sig-Geo <r-sig-geo-bounces using r-project.org> on behalf of
>> Frederico Faleiro <fvfaleiro using gmail.com>
>> *Sent:* 09 September 2019 21:28:32
>> *To:* RsigGeo
>> *Subject:* [R-sig-Geo] Warning in fit.variogram: value out of range in
>> 'bessel k' | automap and gstat packages
>>
>> Dear list,
>>
>> I am trying make an interpolation with the function autoKrige from the
>> package automap, but I received more than 50 times the following warning
>> message:
>>
>> In fit.variogram(experimental variogram, model = vgm(psill = psill, ... :
>> value out of range in 'bessel k'
>>
>> I have tryed identify it in the code of fit.variogram and vgm from the
>> gstat package, but they do not have any warning about it in the code. Then
>> I imagine the warning is from another function.
>> I fitted the variogram automatically in the automap and after I fitted in
>> the gstat to check if there is the same warning for that parameters, but
>> in
>> the last I do not have any warning. When I check the variogram model, it
>> has a good fit apparently. I provided the reproductible example below.
>>
>> Do you know the consequences of this warning and how can I avoid it? I
>> would like to use the automap package because I need interpolate many
>> other
>> files like this.
>>
>> # example
>> library(automap)
>> library(sp)
>>
>> # download the data in:
>>
>> https://urldefense.proofpoint.com/v2/url?u=https-3A__drive.google.com_file_d_1L33-5FQgpNMdwvWff-5FuMrwhl-5FKCajrtlVe_view-3Fusp-3Dsharing&d=DwICAg&c=8NwulVB6ucrjuSGiwL_ckQ&r=DA6jV5X00Z1YpyMh4OS79xeSQGErBqY83CBz841DNnU&m=YlpT3yKlbNVLvXMp08O8X1LkniHGXTzJeLDHLTotwOI&s=U2z98vHb1mpKhKJ9UXA0RUrPi6r6IXibq1cuuyB0jWY&e=
>> # read the data
>> pr <- read.table('pr_monC.txt', header = TRUE, sep = "\t")
>> coordinates(pr) <- ~long+lat
>> # read the grid
>> gr <- read.table('grid.txt' , header = TRUE, sep = '\t')
>> gridded(gr) <-  ~long+lat
>>
>> # automatic fit variogram with automap
>> av <- autofitVariogram(jan~1, pr)
>> # warnings message:   In fit.variogram(experimental variogram, model =
>> vgm(psill = psill, ... : value out of range in 'bessel k'
>> plot(av) # get in the graph the parameters to fit the variogram
>>
>> # fit variogram in gstat with the model parameters from autofitVariogram
>> to
>> check if there is any warning message too
>> ve <- variogram(jan~1, pr)
>> v <- fit.variogram(ve, vgm(psill = 9723, model = "Ste", range = 20, nugget
>> = 194, kappa = 0.8))
>> # it does not produce any warning
>> plot(ve, v)
>>
>> Best regards,
>>
>> Frederico
>>
>>         [[alternative HTML version deleted]]
>>
>> _______________________________________________
>> R-sig-Geo mailing list
>> R-sig-Geo using r-project.org
>>
>> https://urldefense.proofpoint.com/v2/url?u=https-3A__stat.ethz.ch_mailman_listinfo_r-2Dsig-2Dgeo&d=DwICAg&c=8NwulVB6ucrjuSGiwL_ckQ&r=DA6jV5X00Z1YpyMh4OS79xeSQGErBqY83CBz841DNnU&m=YlpT3yKlbNVLvXMp08O8X1LkniHGXTzJeLDHLTotwOI&s=wzYnAjR9sQtl23JiTMc5f1m79m8uQgUt9DSCj3wuTeA&e=
>>
>

	[[alternative HTML version deleted]]



More information about the R-sig-Geo mailing list