EVOLUTION-MANAGER
Edit File: exclude.too.far.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>R: Exclude prediction grid points too far from data</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" href="R.css" /> </head><body> <table width="100%" summary="page for exclude.too.far {mgcv}"><tr><td>exclude.too.far {mgcv}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Exclude prediction grid points too far from data</h2> <h3>Description</h3> <p> Takes two arrays defining the nodes of a grid over a 2D covariate space and two arrays defining the location of data in that space, and returns a logical vector with elements <code>TRUE</code> if the corresponding node is too far from data and <code>FALSE</code> otherwise. Basically a service routine for <code>vis.gam</code> and <code>plot.gam</code>. </p> <h3>Usage</h3> <pre> exclude.too.far(g1,g2,d1,d2,dist) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>g1</code></td> <td> <p>co-ordinates of grid relative to first axis.</p> </td></tr> <tr valign="top"><td><code>g2</code></td> <td> <p>co-ordinates of grid relative to second axis.</p> </td></tr> <tr valign="top"><td><code>d1</code></td> <td> <p>co-ordinates of data relative to first axis.</p> </td></tr> <tr valign="top"><td><code>d2</code></td> <td> <p>co-ordinates of data relative to second axis.</p> </td></tr> <tr valign="top"><td><code>dist</code></td> <td> <p>how far away counts as too far. Grid and data are first scaled so that the grid lies exactly in the unit square, and <code>dist</code> is a distance within this unit square.</p> </td></tr> </table> <h3>Details</h3> <p> Linear scalings of the axes are first determined so that the grid defined by the nodes in <code>g1</code> and <code>g2</code> lies exactly in the unit square (i.e. on [0,1] by [0,1]). These scalings are applied to <code>g1</code>, <code>g2</code>, <code>d1</code> and <code>d2</code>. The minimum Euclidean distance from each node to a datum is then determined and if it is greater than <code>dist</code> the corresponding entry in the returned array is set to <code>TRUE</code> (otherwise to <code>FALSE</code>). The distance calculations are performed in compiled code for speed without storage overheads. </p> <h3>Value</h3> <p>A logical array with <code>TRUE</code> indicating a node in the grid defined by <code>g1</code>, <code>g2</code> that is ‘too far’ from any datum. </p> <h3>Author(s)</h3> <p> Simon N. Wood <a href="mailto:simon.wood@r-project.org">simon.wood@r-project.org</a></p> <h3>References</h3> <p><a href="http://www.maths.bris.ac.uk/~sw15190/">http://www.maths.bris.ac.uk/~sw15190/</a> </p> <h3>See Also</h3> <p><code><a href="vis.gam.html">vis.gam</a></code> </p> <h3>Examples</h3> <pre> 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) </pre> <hr /><div style="text-align: center;">[Package <em>mgcv</em> version 1.8-28 <a href="00Index.html">Index</a>]</div> </body></html>