graph.idw {geospt} | R Documentation |
Graph that describes the behavior of the optimized p smoothing parameter.
Description
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.
Usage
graph.idw(formula, data, locations, np, p.dmax, P.T=NULL, nmax=Inf, nmin=0, pleg,
progress=F, iter, ...)
Arguments
formula |
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 |
data |
SpatialPointsDataFrame: should contain the dependent variable, independent variables, and coordinates. |
locations |
object of class Spatial, or (deprecated) formula defines the spatial data locations (coordinates) such as ~x+y |
np |
number of points, where the idw is calculated |
p.dmax |
maximum value of the range of the p parameter that will be evaluated by the |
P.T |
logical. Print Table (TRUE) or not (FALSE). Default P.T=NULL. |
nmax |
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 |
nmin |
minimum number of nearest observations that should be used for a idw prediction, where nearest is defined in terms of the spatial locations. see |
pleg |
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 |
progress |
logical. Use TRUE to see the percentage of progress of the process and FALSE otherwise). Default progress=FALSE. |
iter |
The maximum allowed number of function evaluations. |
... |
further parameters to be passed to the minimization functions |
Value
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.
References
Johnston, K., Ver, J., Krivoruchko, K., Lucas, N. 2001. Using ArcGIS Geostatistical Analysis. ESRI.
Examples
## Not run:
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)
## End(Not run)