Last chance! 50% off unlimited learning
Sale ends in
TRUE
if
the corresponding node is too far from data and FALSE
otherwise. Basically a service routine for
vis.gam
and plot.gam
.exclude.too.far(g1,g2,d1,d2,dist)
dist
is a distance within this unit square.TRUE
indicating a node in the grid defined by g1
, g2
that
is `too far' from any datum.g1
and g2
lies exactly in the unit square (i.e. on [0,1] by [0,1]). These scalings are
applied to g1
, g2
, d1
and d2
. The minimum Euclidean
distance from each node to a datum is then determined and if it is greater than dist
the
corresponding entry in the returned array is set to TRUE
(otherwise to FALSE
). The
distance calculations are performed in compiled code for speed without storage overheads.vis.gam
library(mgcv)
x<-rnorm(100);y<-rnorm(100) # some "data"
n<-40 # generate a grid....
mx<-seq(min(x),max(x),length=n)
my<-seq(min(y),max(y),length=n)
gx<-rep(mx,n);gy<-rep(my,rep(n,n))
tf<-exclude.too.far(gx,gy,x,y,0.1)
plot(gx[!tf],gy[!tf],pch=".");points(x,y,col=2)
Run the code above in your browser using DataLab