fs.test.RdImplements a finite area test function based on one proposed by Tim Ramsay (2002).
fs.test(x,y,r0=.1,r=.5,l=3,b=1,exclude=TRUE)
fs.boundary(r0=.1,r=.5,l=3,n.theta=20)Points at which to evaluate the test function.
The test domain is a sort of bent sausage. This is the radius of the inner bend
The radius of the curve at the centre of the sausage.
The length of an arm of the sausage.
The rate at which the function increases per unit increase in distance along the centre line of the sausage.
Should exterior points be set to NA?
How many points to use in a piecewise linear representation of a quarter of a circle, when generating the boundary curve.
The function details are not given in the source article: but this is pretty close. The function is modified from Ramsay (2002), in that it bulges, rather than being flat: this makes a better test of the smoother.
fs.test returns function evaluations, or NAs for points
outside the boundary. fs.boundary returns a list of x,y points
to be jointed up in order to define/draw the boundary.
Tim Ramsay (2002) "Spline smoothing over difficult regions" J.R.Statist. Soc. B 64(2):307-319
require(mgcv)
## plot the function, and its boundary...
fsb <- fs.boundary()
m<-300;n<-150
xm <- seq(-1,4,length=m);yn<-seq(-1,1,length=n)
xx <- rep(xm,n);yy<-rep(yn,rep(m,n))
tru <- matrix(fs.test(xx,yy),m,n) ## truth
image(xm,yn,tru,col=heat.colors(100),xlab="x",ylab="y")
lines(fsb$x,fsb$y,lwd=3)
contour(xm,yn,tru,levels=seq(-5,5,by=.25),add=TRUE)