View source: R/outer.convex.hull.R
outer.convhull | R Documentation |
This version of outer
evaluates FUN
only on that part of the grid cx
times cy
that is enclosed within
the convex hull of the points (px,py)
.
This can be useful for spatial estimation if no extrapolation is wanted.
outer.convhull(cx,cy,px,py,FUN,duplicate="remove",...)
cx |
x cordinates of grid |
cy |
y cordinates of grid |
px |
vector of x coordinates of points |
py |
vector of y coordinates of points |
FUN |
function to be evaluated over the grid |
duplicate |
indicates what to do with duplicate
|
... |
additional arguments for |
Matrix with values of FUN
(NA
s if outside the
convex hull).
Albrecht Gebhardt <albrecht.gebhardt@aau.at>, Roger Bivand <roger.bivand@nhh.no>
in.convex.hull
x<-runif(20)
y<-runif(20)
z<-runif(20)
z.lm<-lm(z~x+y)
f.pred<-function(x,y)
{predict(z.lm,data.frame(x=as.vector(x),y=as.vector(y)))}
xg<-seq(0,1,0.05)
yg<-seq(0,1,0.05)
image(xg,yg,outer.convhull(xg,yg,x,y,f.pred))
points(x,y)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.