Last chance! 50% off unlimited learning
Sale ends in
Function for plotting the RMSPE for several values of the p smoothing parameter with the same dataset. A curve is fitted to the points, and
then the optimal p that provides the smallest
RMSPE is determined from the curve, by the optimize
function from the stats
package.
graph.idw(formula, data, locations, np, p.dmax, P.T=NULL, nmax=Inf, nmin=0, pleg,
progress=F, iter, ...)
Returns a graph that describes the behavior of the optimized p parameter associated with the RMSPE, and a table of values associated with the graph including optimal smoothing p parameter, which generates the lowest RMSPE.
formula that defines the dependent variable as a linear model of independent variables; suppose the dependent variable has name z, for a idw detrended use z~1
SpatialPointsDataFrame: should contain the dependent variable, independent variables, and coordinates.
object of class Spatial, or (deprecated) formula defines the spatial data locations (coordinates) such as ~x+y
number of points, where the idw is calculated
maximum value of the range of the p parameter that will be evaluated by the optimize
function
logical. Print Table (TRUE) or not (FALSE). Default P.T=NULL.
maximum number of nearest observations that should be used for a idw prediction, where nearest is defined in terms of the spatial locations. By default, all observations are used
minimum number of nearest observations that should be used for a idw prediction, where nearest is defined in terms of the spatial locations. see krige
the x and y co-ordinates to be used to position the legend. They can be specified by keyword or in any way which is accepted by xy.coords
, by default pleg="topright.
logical. Use TRUE to see the percentage of progress of the process and FALSE otherwise). Default progress=FALSE.
The maximum allowed number of function evaluations.
further parameters to be passed to the minimization functions optimize
or bobyqa
, typically arguments of the type control() which control the behavior of the minimization algorithm. See documentation about the selected minimization function for further details.
Johnston, K., Ver, J., Krivoruchko, K., Lucas, N. 2001. Using ArcGIS Geostatistical Analysis. ESRI.
if (FALSE) {
data(ariari)
data(ariprec)
# p optimization
gp <- graph.idw(PRECI_TOT~ 1, ~x+y, data=ariprec, np=50, p.dmax=4, nmax=15,
nmin=15,pleg = "center", progress=T)
gp
gp$p
library(sp)
library(fields)
plot(ariari)
gridAri <- spsample(ariari,20000,"regular")
plot(gridAri)
idw.p <- idw(PRECI_TOT~ 1, ~ x+y, ariprec, gridAri, nmax=15, nmin=15, idp=2)
pal2 <- colorRampPalette(c("snow3","royalblue1", "blue4"))
# Inverse Distance Interpolations Precipitation Weighted (P = 2)
p1 <- spplot(idw.p[1], col.regions=pal2(100), cuts =60, scales = list(draw =T),
xlab ="East (m)", ylab = "North (m)",
main = "", auto.key = F)
split.screen( rbind(c(0, 1,0,1), c(1,1,0,1)))
split.screen(c(1,2), screen=1)-> ind
screen( ind[1])
p1
screen( ind[2])
image.plot(legend.only=TRUE, legend.width=0.5, col=pal2(100),
smallplot=c(0.6,0.68, 0.5,0.75),
zlim=c(min(idw.p$var1.pred),max(idw.p$var1.pred)),
axis.args = list(cex.axis = 0.7))
close.screen( all=TRUE)
}
Run the code above in your browser using DataLab