November 2018
Beginner to intermediate
354 pages
6h 59m
English
In Inverse Distance Weighting (IDW), the predicted value at a point is a weighted average of the values measured at different points. Here, we create a model without independent variables with the following command:
install.packages("gstat")library(gstat)g = gstat(formula = value ~ 1, data = temp)
By using gstat(), we create a gstat object that can now be utilized to make predictions of temperature using interpolate() in the following way:
prediction = interpolate(dem, g)
Now plot the predicted raster along with the observed data:
plot(prediction)plot(temp, add = TRUE, pch = 18, cex = 0.5)
We see that we now have a much smoother prediction of temperature over a continuous area:
Read now
Unlock full access