title: Remove values outside Loess curve limits
body: <p>I am looking to remove outliers before I apply a model. I am using a Loess curve to delimit the trend line and have set outlier limits. I would like to remove the rows that are outside the defined limits. Besides doing this with a custom function that takes each point one at a time and checks the local Loess slope etc... is there an easier way?</p>
  
  <p><img src="https://i.stack.imgur.com/u4McU.png" alt="Loess trend line with limits (1.2)"></p>
  
  <pre><code># Code generating image above
  scatter.smooth( idam$T_d, idam$T_x10d)
  loessline &lt;- loess.smooth( idam$T_d, idam$T_x10d)
  lines(loessline$x, loessline$y, lwd=3)
  lines(loessline$x, loessline$y*1.2, lwd=3, col='red')
  lines(loessline$x, loessline$y/1.2, lwd=3, col='red')
  </code></pre>