Hot answers tagged

37

Both forms rely on Toblers first law of geography: things that are close are more related than things that are further apart. IDW is the simpler of the two techniques. It involves using known z values and weights determined as a function of distances between the unknown and known points. As such in IDW points that are far away have far less influence than ...


30

When you use "default values" you aren't really kriging, you're just applying the kriging algorithm--which as you have found, is poor when used with these data. (I will step up on a soapbox for a brief rant: in my opinion, the fastest way to get bad results with a computer program is to accept its default parameters. ArcGIS is one of the richest, most ...


16

This error is commonly returned because you have duplicate locations. You can check this using the sp::zerodist function. To remove duplicate locations you call sp::zerodist within a bracket index. WeatherData <- WeatherData[-zerodist(WeatherData)[,1],]


15

In order to interpolate prices with kriging you first need to convert your geographic coordinates to projected coordinates. Assuming you have them, below there is a reproducible example, showing a way to accomplish such task. library(sp) #Spatial data containing variables which can be interpolated. #We will use the zinc column; as an equivalent for 'price'....


10

The great thing about QGIS is its modular design, based on which you can use the geoprocessing engines of various other systems directly as tools in QGIS (GRASS, SAGA, GDAL, OGR, ...). In order to do so, you need to activate the 'processing' extension. Then you can switch on the 'Geoprocessing Toolbox' via menu 'Processing' > 'Toolbox'. Searching for '...


9

In a nutshell, the problem lies in a mismatch between data behavior and some (strong) assumptions you are implicitly making. Diagnosis The strongest of these is that the data are one realization of a second-order stationary process. They clearly are not, as you can tell by comparing the region near (450000, 5075000) in the upper "neck" (which I ...


7

Some has already been said by Spacedman in the comments. This warning may not pose a problem, if the variogram looks good. A good option might be to initialize some of the variogram parameters in vgm("Sph"). I usually take these values as default: vario <- variogram(Temperature ~1, WU_data_spatial) vario.fit <- fit.variogram(vario, vgm(psill=...


6

Yes. The standard methods used to cross-validate and assess Kriging also apply, practically with no change, to almost any other method of interpolation. These include jackknifing, a form of leave-out-one cross-validation in which each data point is systematically removed from the dataset and predicted using the chosen variogram model. The discrepancy ...


6

In your case, where you have a multivariate problem, ordinary Kriging is quite inappropriate. I find your interpretation of this as an "interpolation" problem is a bit off base as well. This is an estimation problem and more suited for Machine Learning or spatial regression, not geostatistics. The grey area are Splines. This can be a univariate interpolation ...


6

When the prediction error of a model based on log(Y) is Gaussian like here, you normally should use the correction of Laurent (1963) to estimate back to the original scale. In your case: MeanY = exp(a$var1.pred + 0.5 * (a$var1.var)) and: SdY = exp(2*a$var1.pred + a$var1.var)*(exp(a$var1.var)-1) You can verify on yourself with simulation of a Gaussian ...


5

In sp, SpatialPoints*, SpatialPixels* and SpatialGrid* (with * omitted or replaced by DataFrame) do support more than 2 spatial dimensions, as OP has done, but SpatialPolygons* and SpatialLines* do not. With gstat you can do 3-D block kriging with 3-D blocks (using block = c(10,10,10)), but you cannot do this for non-rectangular blocks, as OP wants. It is ...


5

For reliable methods, I would do a literature review to find the best option given your time, resources and questions you are trying to accomplish. This one, so far, is popping out


5

This is perfectly legitimate. It is based on the assumption that the covariance structure of the random field does not change from time to time. One way to see that this is OK (without writing complicated statistical formulas) is to suppose that the data at each time have the same relative locations--leaving the distances and bearings unchanged--but have ...


5

If you are just after a metric of performance, this is a fairly straight forward type of analysis to specify. 1) specify a model, 2) predict the model(s) at the data, 3) apply an accuracy/performance metric based on observed vs. predicted. We can step through the process thus (note; this is a dummy example so, ignore the REML errors): First lets specify ...


5

If you want to limit kriging to only interpolate within the polygons, you could adjust your Environment Settings. You can do this by selecting Geoprocessing - Environment Settings. Within there you should select Raster Analysis. This is where you can set the Mask for your workspace. Raster Analysis performed in your workspace will only be performed within ...


5

I don't know what kind of interpolation you're talking about but if average of all neighbours will be good value this could be the solution: create table hex_grid_data_av as ( select gid, wkb_geometry, value, case when value > 0 then value else (select sum(h2.value)/6 from hex_grid_data h2 where ST_Touches(h1.wkb_geometry, h2....


5

in theory, ordinary kriging is exact. However, if you interpolate on a grid, the probability that the center of the pixel (where the interpolated value is computed) falls exactly on an observed point is very very small. Therefore, the interpolated pixel value will not likely be the same as the points that are under it. This difference will be more apparent ...


5

I would write an R script that worked as a client, but will run on the database server. This will save the complication of trying to hook into PostGIS's backend and using PL/R (as I said in comments). The script will look something like this (which is practically pseudo-code here): > con = dbConnect(PG,"localhost","weather") # connect to local DB >...


5

Following a bit on what Jeffrey Evans said, you must remember that your data points define an area that's called convex hull. It is the (convex) polygon of minimum area that contains your data points. Values of locations inside that polygon can be estimated by interpolation (kriging, splines, IDW, etc). Outside that polygon you don't have interpolation, but ...


5

You are confusing terms and thus, confusing us. The expected input for kriging prediction in the gstat krige function is a systematic array of points and not polygons. It would also be nice if you provided a reproducible code example of what you have tried. You can use the extent of an sp object to create an array of points for the kriging prediction using ...


5

As I pointed out, you had identical observations. Additionally, you were not using the "resolution" argument in the raster function so, were only creating 100 pixel observations to predict to. I had to fix the tab returns in the file that you posted on dropbox, which was not appreciated. Here is code that I got to work. library(gstat) ...


5

You are correct about value you referred to, the residuals: An excerpt from Esri's Regression analysis basics Residuals: These are the unexplained portion of the dependent variable, represented in the regression equation as the random error term ε. View an illustration. Known values for the dependent variable are used to build and to calibrate the ...


5

Is it true that we're just using a different set of weight values than the 1/distance in IDW? Yes, both IDW interpolation and Ordinary Kriging (OK) will calculate weights based on distance, but with different criteria. In both methods, weights do not depend on sample values. The answer from Dahn Jahn in Ordinary kriging example step by step? is very ...


5

After the study of https://rpubs.com/nabilabd/118172 and https://rpubs.com/nabilabd/134781 I assembled the following solution. library(sf) library(sp) library(gstat) library(tidyverse) Here are points I would like to play with. dt<-tibble::tribble( ~id, ~lon, ~lat, ~z, "a", 1.1, 1.3, 12.5, "b", 2.4, 1.7, 13.0, "c", 3.2, 1.4, ...


4

Either: generate a regular grid of points in the lat-long coordinate system, transform to ETRS89 using spTransform, and plug those points into whatever kriging package you are using (you don't say, you don't give examples), get the estimates, and back-transform with spTransform to lat-long. do your kriging in a regular grid in your ETRS89 system, then ...


4

If you leave the cell size blank you are telling ArcMap to choose its own, by your admission you've indicated that the data is dense so a small cell size would be suitable. e-006 means 6th decimal place (so 1e-006 is 0.000001). Is your source data in geographic coordinates (lat/lon)? this would explain the difference in cell dimensions i.e. stored in ...


4

You can use "writeGDAL" in the rgdal package. Use the "asc" extension to specify an ESRI ASCII raster format. You will need to pull the associated sp object and pass it to writeGDAL. This is vaguely indicated in the help: "This function returns an autoKrige object containing the results of the interpolation (prediction, variance and standard deviation), the ...


4

See this answer from ESRI stating kriging considered exact and this nice description from expert course material that also goes the same route. Generally, kriging is associated with exactness but according to ESRI: When semivariogram and covariance models have a nugget effect there is potential for a discontinuity in the predicted surface at the sample ...


4

KrigingModelOrdinary is another function in the arcpy.sa module. If you want to use it as a variable, it needs to be defined earlier in your code. The Arc help page walks through the necessary inputs/usage; the following is a snippet based on their example. # Create KrigingModelOrdinary Object lagSize = 70000 majorRange = 250000 partialSill = 180000 nugget =...


4

One possibility underlying the poor kriging performance could be the field plots (location and sampling intensity) failing to capture the spatial autocorrelation (or spatial dependence) in the data. It would be necessary to observe how well the theoretical semivariogram fitted to the data (experimental semivariogram) (Figure 1). If it is the case, one ...


Only top voted, non community-wiki answers of a minimum length are eligible