Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: Cressie variogram estimator doubles variance #76

Closed
MuellerSeb opened this issue Mar 28, 2020 · 3 comments
Closed

Bug: Cressie variogram estimator doubles variance #76

MuellerSeb opened this issue Mar 28, 2020 · 3 comments
Assignees
Labels
bug Something isn't working
Milestone

Comments

@MuellerSeb
Copy link
Member

I found a bug in the cressie variogram estimator. It seams, that the estimated sill is twice as much as the input:

import numpy as np
import gstools as gs

x = np.random.RandomState(19970221).rand(1000) * 100.0
y = np.random.RandomState(20011012).rand(1000) * 100.0
model = gs.Exponential(dim=2, var=2, len_scale=8)
srf = gs.SRF(model, mean=0, seed=19970221)
field = srf((x, y))

bins = np.arange(40)
bin_center, gamma = gs.vario_estimate_unstructured((x, y), field, bins, estimator="cressie")

fit_model = gs.Stable(dim=2)
fit_model.fit_variogram(bin_center, gamma, nugget=False)

print(fit_model)

gives:

Stable(dim=2, var=3.9951222666072255, len_scale=8.859244705331834, nugget=0.0, anis=[1.], angles=[0.], alpha=1.065254356901576)

Figure_1

So it seams, there is a division by 2 missing here:

(1./counts[i] * variogram[i])**4 /

@MuellerSeb MuellerSeb added the bug Something isn't working label Mar 28, 2020
@MuellerSeb MuellerSeb added this to the v1.2.1 milestone Mar 28, 2020
@MuellerSeb
Copy link
Member Author

Fixed here: 0649e61

@MuellerSeb
Copy link
Member Author

And here: cbcef65

@MuellerSeb
Copy link
Member Author

Commits were cherry-picked into #75

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants