Your last question was easy to answer, this one is more difficult. You could look at correlation and dependence, but you'd be better off looking at variography. That's the easier part of this question dealt with. Most resource geologists do not deal with correlation & dependence, they do variography studies.
If you are dealing with a small data set to familiarize yourself with the concept of spatial continuity then writing code in any suitable computer language is okay. If however, you are analyzing a large or complex data set use a package which has been created to analyze such data.
To analyze a large or complex data set, the data will first have to be declustered so that data points are fairly uniformly distributed throughout the data set. The other thing that will then need to be done is to establish a three dimension search ellipsoid so that only data within the 3D ellipsoid is considered with each calculation of the variance - the 3D ellipsoid will be similar in shape to a rugby football or an Australian Rules football. The 3D ellipsoid will also have to be able to orientated in a specified search direction. It will then have to be positioned on each declustered data point and geostatistical variances determined for each point - note, the mathematical expression for geostatistical variance is slightly different to the one used by mathematicians - you can blame George Matheron for that.