fs.test | R Documentation |

Implements 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)

`x,y` |
Points at which to evaluate the test function. |

`r0` |
The test domain is a sort of bent sausage. This is the radius of the inner bend |

`r` |
The radius of the curve at the centre of the sausage. |

`l` |
The length of an arm of the sausage. |

`b` |
The rate at which the function increases per unit increase in distance along the centre line of the sausage. |

`exclude` |
Should exterior points be set to |

`n.theta` |
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 `NA`

s 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.

Simon N. Wood simon.wood@r-project.org

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)

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.