################################################################################ ######################## Semivariogram Cloud ################################## ################################################################################ vgm_cloud = (variogram(gw~1,A,cutoff=500, cloud=T)) # 453 is max distance ?variogram plot(vgm_cloud) View(vgm_cloud) class(vgm_cloud) write.table(vgm_cloud, file="E:/GIS_Tutorial/Groundwater_Flow_Course/Data/cloud_points.xls", sep=",") ?write.table #with ggplot ggplot(vgm_cloud,aes(x=dist,gamma)) + geom_point(colour = "blue", size = 1) + labs(x="Distance [m]",y="Gamma", title = "Semivariogram", subtitle="Raw Data - semivariogram Cloud") + theme(plot.title = element_text( face = "bold",size = 20,hjust =0.5, color = "black")) + theme(axis.text = element_text(colour = "black", size =10, face = "bold"))+ theme(plot.subtitle=element_text(size=12, hjust=0.5, face="italic", color="black")) # to identify pairs sel = plot(variogram(gw~1, A,cutoff=500, cloud = T),digitize = T) plot(sel, A) ################################################################################ # Experimental semivariogram Omnidirectional g = gstat(id='gw', formula=gw~1,data = A) #gstat object vgm1 = variogram(g) #trend is obvious head(vgm1) #data for the first six vgm1 #data for all plot(vgm1) # distance is 150 m because R by default take max (453 m) distance/3 # we can increase the cutoff distance to have at least the the half of max dist: vgm1 = variogram(g, cutoff=450, width=15) vgm1 #see how lag changes as we change the width plot(vgm1) View (vgm1) pair_count = ggplot(data = vgm1) + geom_col(mapping = aes(x = dist, y = np), width = 0.01, color = "blue") + labs(x="Distance [m]",y="Number of Points") + theme(plot.title = element_text( face = "bold",size = 20,hjust =0.5, color = "black")) + theme(axis.text = element_text(colour = "black", size =10, face = "bold"))+ theme(plot.subtitle=element_text(size=12, hjust=0.5, face="italic", color="black")) + geom_hline(aes(yintercept = var(Adf$gw), color="Variance"), linetype="dashed", size=1) + scale_color_manual(name = "Statistics", values = c(Variance = "red")) plot(pair_count) #with ggplot plus the variance line Semivario1= ggplot(vgm1,aes(x=dist,gamma)) + geom_point(colour = "blue", size = 1) + labs(x="Distance [m]",y="Gamma", title = "Semivariogram", subtitle="Raw Data - Omnidirectional Semivariogram") + theme(plot.title = element_text( face = "bold",size = 20,hjust =0.5, color = "black")) + theme(axis.text = element_text(colour = "black", size =10, face = "bold"))+ theme(plot.subtitle=element_text(size=12, hjust=0.5, face="italic", color="black")) + geom_hline(aes(yintercept = var(Adf$gw), color="Variance"), linetype="dashed", size=1) + scale_color_manual(name = "Statistics", values = c(Variance = "red")) plot(Semivario1) # stack two plots # to stack plots library(gridExtra) grid.arrange(Semivario1, pair_count, ncol = 1, heights = c(3, 1))
@flaviobellino98334 жыл бұрын
@Geo RGB my congratulations. I’m trying to soak up all your lectures in a few days and I look forward to start soon in my field (agronomy). It’s remarkable how you promote the use of open source tools and contemporary the spread of of knowledge on such a topic.Thank you very much
@GeoRGBCommunity3 жыл бұрын
Thank you very much for your positive and nice comment :)
@MuhammadUsman-pv4ds Жыл бұрын
Great work done with very very clear explanation. Thanks for the efforts.
@GeoRGBCommunity Жыл бұрын
Thanks for your comment
@MuhammadUsman-pv4ds Жыл бұрын
Great hard work to do all this. Appreciated and thanks so much
@GeoRGBCommunity Жыл бұрын
Thanks!!!
@sejald53403 жыл бұрын
Amazing video series! Couldn't find such a detailed explanation on Kriging anywhere. Just a small question : How do I know what lag is appropriate for my case? For example, you have selected 15 based on your experience. If I am a beginner in this topic how should I decide the lag distance for a different set of data? Is there any theoretical basis for it that I can look up?
@GeoRGBCommunity3 жыл бұрын
Hi Sejal, thank you for being active in the comment section, I really appreciate it. This question is very interesting and I am pretty sure that you can get the answer by your own after trying to use the common sense. I will provide you the inputs, and you have to work on the outputs. 1) In each lag we have one point of information that represents the experimental semivariogram. 2) That point of information is the average of all pairs of data in the given lag. 3) As much pairs of data in a given lag, more representative is going to be the point of information in the experimental semivariogran. 4) We want to capture in each lag distance pairs of data with similar values for the semivariance, in order to avoid having an experimental semivariogram too much generic, with a big range of semivariance. 5) We want an equilibrium between number of pair of data and the value of the semivariance. 6) Take a look on your cloud of points and try to do a grid with the lag distances and the semivariance values. Then, ask yourself if the data inside each box looks homogeneous. Also, you can try different lags distances, and see the experimental semivariogram. Then, you can establish limits, for example, for this range of lag distances the experimental semivariogram does not change too much but when I out of this range the experimental semivariogram is quite different. Honestly, I do not know if there is any tool to know exactly what has to be the lag distance, but you can use the common sense to have a good result. Good luck!!!!
@sejald53403 жыл бұрын
@@GeoRGBCommunity Thanks a lot! I will try to figure it out for my case now
@kirangandhi68844 жыл бұрын
Hi Marcel, such a great tutorials on Geostatistics. i followed all your tutorials on variogram. I faced an issue with my data, where i don't see any trend because the locations are far apart and no significant difference in targeted parameter(insect no.). Is there any solution for this?
@GeoRGBCommunity4 жыл бұрын
Hi Kiran gandhi. Thank you very much for your comment, it is awesome to get some feedback. If your data is very poor and the gap of data between samples/observation is big enough to be not representative of the phenomenon is better not to do kriging interpolation. One potential solution is to do cokriging but you need other second parameter that is spatially correlected with the target parameter in order to fill the gaps of information. Have a great day.
@nept4ne4 жыл бұрын
@Geo RGB Great class! In the min 38:02 I understand that cutoff (450) is because of the max quantile. About width. How do I know which number I can put in width?. Thanks for this great class.
@GeoRGBCommunity4 жыл бұрын
Hi Harry, thank you very much for your comment and welcome to GeoRGB! The cutoff is the distance that you want to plot in your graph and it is related to the number of lags. For example, if your lag distance is 15 and you have 30 lags, the cutoff is 30 x 15 = 450. The lag distance is known as "Width" in R. The lags distance is how width are going to be the lags in the bin. Inside of each lag you are going to have your samples or observations and you are going to do the average for the semivariance and for the distance to get a point of information for each lag to create the experimental semivariogram. Then the distance of the lag (width in R) has to be representative of the samples located in each lag. You have to decide what is the best lag distance, according with the number of samples and their spatial location. I am not sure if it is clear enough, I know it could be a little bit confusing. At the next video your are going to have more information about the bins and lag distances. Cheers!
@nept4ne4 жыл бұрын
@@GeoRGBCommunity Thanks for the answer.
@rainxia26573 жыл бұрын
@@GeoRGBCommunity Thanks for your detailed reply.
@mengistubosie972 жыл бұрын
how can i get the scripts for rstudio in this video
@GeoRGBCommunity2 жыл бұрын
Just get enrolled totally for free at the course giscourse.online/courses/geostatistical-analysis-course-kriging-interpolation-groundwater-flow-map/ at the bottom of each lesson you have a button to download the files.
@pravakirandash97583 жыл бұрын
First of all a huge thanks for such a wonderful explaination. I was running the code vgm_cloud = (variogram (gw~1, A,cutoff=500, cloud=T)), but go an error like Error in gstat(formula = object, locations = locations, data = data) : argument "data" is missing, with no default Could you please me help with this error?
@GeoRGBCommunity3 жыл бұрын
Hi Prava. Thank you very much for being active at the comment section and for the positive comment. I am not sure what could be the problem. The point is that the software cannot find the dataset, in this case “A”. I am wondering if you had any other issue when you run the first scripts related to the data, I mean the section I called “Load data, view data & statistics” from the lesson 4 Experimental semivariogram. Maybe you can send me a screen shot with the coding. Make sure you are using point (“.”) for decimals instead of using comma (“,”) in your spreadsheet (dataset). Let's see if we can find the error step by step. Cheers!
@pravakirandash97583 жыл бұрын
@@GeoRGBCommunity Thanks a lot! I just tried it for some more time with some minute changes and it worked! Thanks a lot! These are amazing videos! Very enriched!
@akashchowdhury45093 жыл бұрын
Can you give the scripts for rstudio in this video
@GeoRGBCommunity3 жыл бұрын
Hi Akash, the code is at the comment section, you can copy and page on RStudio. Have a great day.