Date  File  Comment by  Comment  Rating 

23 Oct 2014  variogramfit fits different theoretical variograms to an experimental variogram  steve  function [a,c,n,S] = variogramfit(h,gammaexp,a0,c0,numobs,varargin) h=[2.238; 2; 3; 5.657; 2.238; 1.414;3.606; 3.606; 4.472; 4.123];
% check input arguments if ~exist('a0','var')  isempty(a0)
% check if fminsearchbnd is in the search path
% check if h and gammaexp are vectors and have the same size
switch lower(params.model)
% nugget variance
% create weights (see Webster and Oliver)
% create objective function: weighted least square
% create vector with initial values
if nugget;
% fitting functions for fminsearch/bnd
end 

23 Oct 2014  variogramfit fits different theoretical variograms to an experimental variogram  steve  look at that code and please advice me accordingly. i am trying to come up with a variogram for modeling but i just cannot get through. thanks 

23 Oct 2014  variogramfit fits different theoretical variograms to an experimental variogram  Wolfgang Schwanghart  @steve: thanks for your comment. variofun is a subfunction that you'll find below the main function. 

23 Oct 2014  variogramfit fits different theoretical variograms to an experimental variogram  steve  nice work there. what am wondering is what does variofun mean? since am trying to run that code am being told that it is an undefined variable. please help 

09 Apr 2014  Experimental (Semi) Variogram calculate the isotropic and anisotropic experimental (semi) variogram  Carlos  Wolfgang, Thanks for this awesome submission. It was very helpful. I however have a questions.. On line 165 you perform the following operation edges(end) = inf; Can you explain the logic behind it? The reason that I ask it that when the data is uniformly distributed in space the number of data pairs separated by a lag (h) decreases as h increases. However, as written line 165 then makes later lines (l78 and 179) S.val = accumarray(ixedge,...
Calculate the gamma value and the number of pairs using the the rest of the data set. You then do a final modification of the arrays but that does eliminate the extra data poins used int he Variogram calculation.. Let me give you an example. My edges vector before line 165 250 500 750 1000 1250 1500 1750 2000 2250 2500 2750 3000 My edges vector after line 165 250 500 750 1000 1250 1500 1750 2000 2250 2500 2750 Inf Then on lines
you produce the S.distance,S.num and S.val struct arrays This is what the S.distance says: 625
Then this is what the S.num says: 41
You see That 59 should not be there there are no 59 number of data pairs with an average lag distance of 2875. In fact there are only 30. If I comment line 165 then I get the expected result of monotonically decreasing number of pairs as lag distance increases. Let me know what you think... Carlos Soto 

04 Mar 2014  Experimental (Semi) Variogram calculate the isotropic and anisotropic experimental (semi) variogram  kaiba Wong  Fantastic code  just what I needed. However, I am trying to modify it a bit for crossvariogram. Can I do it this way: save the
Is this approach correct?


26 Feb 2014  variogramfit fits different theoretical variograms to an experimental variogram  Wolfgang Schwanghart  @Roque Santos: Hi, see here: http://blogs.mathworks.com/community/2010/12/13/citingfileexchangesubmissions/ 

23 Feb 2014  variogramfit fits different theoretical variograms to an experimental variogram  Roque Santos  Hello friend,


25 Jan 2014  Experimental (Semi) Variogram calculate the isotropic and anisotropic experimental (semi) variogram  Zoltán  Hi Wolfgang! Thank you for this, it is a very good one! Could you please explain me, where is your algorithm calculate the separation (or lag) vector(h). Theoretically, if I am calculating a variogram, I use this formula: gamma^2(h)=(1/2N(h))*sum(f(u+h)f(u))^2 Did you used the same? If yes, how do you calculated h? (in which row?) Thank you! Zoltán 

06 Jan 2014  variogramfit fits different theoretical variograms to an experimental variogram  Wolfgang Schwanghart  @Roque Santos: thanks for your comment. Please check the documentation for varargin here: http://www.mathworks.de/de/help/matlab/ref/varargin.html 

06 Jan 2014  variogramfit fits different theoretical variograms to an experimental variogram  Roque Santos  Hello, ... great code! Congratulations on your initiative!


06 Dec 2013  Experimental (Semi) Variogram calculate the isotropic and anisotropic experimental (semi) variogram  Wolfgang Schwanghart  @JG: Yes, [x y] can also be a nx1 vector with n number of points in time. Use datenum to calculate a numeric vector from your dates. Variogram doesn't do the conversion for you. 

06 Dec 2013  Experimental (Semi) Variogram calculate the isotropic and anisotropic experimental (semi) variogram  J G  Thanks Wolfgang. Also, can this be used for temporal separation too? i.e., can [x y] be time? 

25 Nov 2013  Experimental (Semi) Variogram calculate the isotropic and anisotropic experimental (semi) variogram  Wolfgang Schwanghart  @JG: This syntax is correct. Take care, however, if latitude and longitude refer to geographic coordinates... The function doesn't calculate distances on a sphere. 

25 Nov 2013  Experimental (Semi) Variogram calculate the isotropic and anisotropic experimental (semi) variogram  J G  Thanks for this!
If I have latitude and longitude coordinates ([x y]), and my data (z), I use: variogram([x y],z) 

24 Sep 2013  Experimental (Semi) Variogram calculate the isotropic and anisotropic experimental (semi) variogram  Wolfgang Schwanghart  @Edgar. Hi Edgar, yes, this seems to be an error in the function. Thanks for reporting it! I hardly needed those plot options so I probably forgot to care for them when adding anisotropy. Regarding your earlier question, I suppose that this should be ok. I'll see if I can make a update in the next couple of days. Unfortunately, my time to support these functions at the moment is quite scarce... 

24 Sep 2013  Experimental (Semi) Variogram calculate the isotropic and anisotropic experimental (semi) variogram  Edgar  Hi Wolfang,
Best,


10 Sep 2013  Experimental (Semi) Variogram calculate the isotropic and anisotropic experimental (semi) variogram  Edgar  Hi Wolfang, I'm working with meteorological data, I can see a mountain range drives the spatial variation of the meteorological fields. The mountain range has an orientation (larger axis) at 110° (calculated clockwise from top, i.e. positive latitud axis). The corresponding semivariogram from your script would be the one at 20°? Thanks for your help. Really nice algorithm, congrats! 

29 Aug 2013  variogramfit fits different theoretical variograms to an experimental variogram  Jeff  Very helpful, thank you. I made a small change so that the nugget can be specified directly and not optimized:
It's not pretty, but it works. 

12 Aug 2013  Experimental (Semi) Variogram calculate the isotropic and anisotropic experimental (semi) variogram  Ricardo  Hi Wolfgang,


09 Aug 2013  variogramfit fits different theoretical variograms to an experimental variogram  Wolfgang Schwanghart  @Ludwig: Yes. The output is the function parameter, which means that b(1) (or a or S.range) is 1/3 of the range. Sorry for the confusion. Perhaps I should at least provide two different values (S.range and b(1)) in the structure array output. 

09 Aug 2013  Experimental (Semi) Variogram calculate the isotropic and anisotropic experimental (semi) variogram  Wolfgang Schwanghart  Hi Ricardo, I am afraid my kriging won't work in three dimensions. However, it shouldn't be a very big deal do modify the function to do so. However, I am skeptical how you want to handle time and space dimensions in calculating one variogram. 

09 Aug 2013  Experimental (Semi) Variogram calculate the isotropic and anisotropic experimental (semi) variogram  Ricardo  Hi again,


09 Aug 2013  Experimental (Semi) Variogram calculate the isotropic and anisotropic experimental (semi) variogram  Ricardo  
09 Aug 2013  Experimental (Semi) Variogram calculate the isotropic and anisotropic experimental (semi) variogram  Ricardo  Thank you so much Wolfgang!


09 Aug 2013  variogramfit fits different theoretical variograms to an experimental variogram  Ludwig  @Wolfgang: My issue was around the output. For unbounded models, won't S.range (or a) be 1/3 of the range since it is just assigned b(1)? 

08 Aug 2013  variogramfit fits different theoretical variograms to an experimental variogram  Wolfgang Schwanghart  @Ludwig: I know that the way range is used for unbounded models is confusing. When supplying the initial values you should enter the range where the model reaches about 95% of the sill variance. I decided to do so, since it can be easier visually determined from the experimental variogram and can better compared to bounded models. The parameter b(1) in the exponential variogram model


08 Aug 2013  variogramfit fits different theoretical variograms to an experimental variogram  Ludwig  I am working with fitting exponential models to my data and was a bit confused about the outputted range. Should the range be 3x the fitted parameter that is currently being called the range? When I ask the function to include a plot I can see that the given range is not 95% of the sill. It is possible I am having a misunderstanding. 

01 Aug 2013  variogramfit fits different theoretical variograms to an experimental variogram  Aditi  
25 Jul 2013  Experimental (Semi) Variogram calculate the isotropic and anisotropic experimental (semi) variogram  Wolfgang Schwanghart  @Riccardo: variogram supports higher dimensional data. In your case, just call the function like


25 Jul 2013  Experimental (Semi) Variogram calculate the isotropic and anisotropic experimental (semi) variogram  Ricardo  Hello Wolfgang,


16 May 2013  neighbor indexing returns neighbors of cells in n*m matrices  Fernando Gonzalez  Very useful! 

24 Apr 2013  variogramfit fits different theoretical variograms to an experimental variogram  meo  
24 Apr 2013  Ordinary Kriging 2Dinterpolation using geostatistics  meo  
04 Apr 2013  Ordinary Kriging 2Dinterpolation using geostatistics  Willy  @Wolfgang: I really appreciate your interactivity and your pertinence in all your comments. I just coded the Deutsch method to solve the problem of the negative weights. Thanks to your doi link. Thus, the gaussian variogram is now well working :) Here are the lines code to insert within the "for" loop, between the paragraphs "solve system" and "estimate zi". However, I'm not an excellent developper. I'll let you find some better/faster way to code this. % solve system


03 Apr 2013  Ordinary Kriging 2Dinterpolation using geostatistics  Wolfgang Schwanghart  @Sébastien: Thanks for pointing at the error when using a nugget variogram. I am currently abroad, so I probably won't find much time to update the function. So, in the meantime please adopt the changes proposed by Sébastien. The problem with the gaussian variogram is most likely due to negative weights (see http://dx.doi.org/10.1016/00983004(96)000052 ). I will try to implement the procedure suggested by Deutsch (1996) in a future update. 

03 Apr 2013  Ordinary Kriging 2Dinterpolation using geostatistics  Sébastien  Very nice submission. I was amazed by its speed.
1) there is a mistake in the code when expanding b with ones. It should be the following:
2) I have the same problem than Kirsten: it's working well with spherical variograms. However, when I apply a gaussian one, huge values are found. I'm actually investigating the problem. If I find something, I'll let you know. But I would appreciate if you find the solution first ;) 

15 Feb 2013  Ordinary Kriging 2Dinterpolation using geostatistics  Wolfgang Schwanghart  @Imran Zafar: Fig. 4 shows the kriging variance which quantifies the uncertainty of the kriging estimates. You will note, that the kriging variance increases with increasing distance from observations. 

11 Feb 2013  Ordinary Kriging 2Dinterpolation using geostatistics  Imran Zafar  @Wolfgang Schwanghart: can you please illustrate the figure showing 4 plots? No description given. Please get back 

02 Jan 2013  Experimental (Semi) Variogram calculate the isotropic and anisotropic experimental (semi) variogram  Wolfgang Schwanghart  Hi Shen, you are right! Thanks for pointing out this bug. Seems I have not thoroughly checked the multidimensional support since I've never needed it. I'll correct for it as soon as possible. Thanks again,


02 Jan 2013  Experimental (Semi) Variogram calculate the isotropic and anisotropic experimental (semi) variogram  Shen Liu  Hi Wolfgang, I am not sure if the following had been spotted: In Line 253, when calculating the distances for more than two dimensions, the code was
I think it should be
Many thanks for your function. It is absolutely fabulous! Best regards,


27 Dec 2012  variogramfit fits different theoretical variograms to an experimental variogram  Wolfgang Schwanghart  @ C Gutierrez: I think I haven't seen this error so far. Can you send me more information on how you have called variogramfit via the "contact author" interface? 

27 Dec 2012  Experimental (Semi) Variogram calculate the isotropic and anisotropic experimental (semi) variogram  Wolfgang Schwanghart  @vipul utsav: the nugget variance is the variogram value at zero lag distance. You can estimate it visually from the experimental variogram or (better) use variogramfit (http://www.mathworks.de/matlabcentral/fileexchange/25948) to estimate it from the data. 

27 Dec 2012  Experimental (Semi) Variogram calculate the isotropic and anisotropic experimental (semi) variogram  vipul utsav  nugget variance from variogram ,how it is possible? 

13 Dec 2012  Experimental (Semi) Variogram calculate the isotropic and anisotropic experimental (semi) variogram  Wolfgang Schwanghart  @dd: Right now, this is not possible, but with a minor modification of the function, it is not a problem. Just enter following line in the section where the output for the type 'cloud1' is calculated (Line 202) S.ij = iid(:,[1 2]); This gives you the indices for each point pair. You can now take these to calculate e.g. the correlation coefficient for a binned lag distance. x = rand(1000,1)*42;
% should give you this
distance: [382476x1 double]
distbins = unique(d.distance); % calculate the correlation coefficient
corrcoef(z(d.ij(I,1)),z(d.ij(I,2))) ans = 1.0000 0.2306
Hope it works out for you. Cheers, W. 

13 Dec 2012  Experimental (Semi) Variogram calculate the isotropic and anisotropic experimental (semi) variogram  dd  @ Wolfgang:


12 Dec 2012  Experimental (Semi) Variogram calculate the isotropic and anisotropic experimental (semi) variogram  Wolfgang Schwanghart  @dd: the covariance (C(h)) as a function of lag distance h is directly related to the semivariogram (gamma(h)) and can be calculated by gamma(h) = C(0)C(h) You can take the sill variance as C(0) but this only works for bounded variograms. Why do you need the correlation or covariance? 

12 Dec 2012  Experimental (Semi) Variogram calculate the isotropic and anisotropic experimental (semi) variogram  dd  Hi Wolfgang,


12 Dec 2012  Experimental (Semi) Variogram calculate the isotropic and anisotropic experimental (semi) variogram  dd  
16 Oct 2012  Ordinary Kriging 2Dinterpolation using geostatistics  Kirsten  I sent this dataset to Wolfgang and Yesid, but in case anyone else wants to take a look here's my issue... I've used this dataset with an exponential and spherical model and get good results, but when I use the gaussian model it goes crazy at the domain edges. It will even predict min and max values smaller/larger than those in the original dataset, which should not be possible (and doesn't happen with the other variogram models). The problem seems to be worst at the edge where x=23.45 (I'm using leaveoneout validation and getting strange answers). Thanks for your help!

