title: R: Calculating MSE
body: <p>I've got a function, I've added noise to it, then smoothed it to get a regression line. How can I find the MSE between the original function and the regression line at 30 equally spaced points?</p>
  
  <p>Or, how can I give R an x value and get the y value on a regression line?</p>
  
  <p>This is a scaled down version of my problem:</p>
  
  <pre><code>&gt; test&lt;- function(m) {3*m^2+7*m+2}  
  &gt; r=rnorm(10)  
  &gt; m=1:10/10  
  &gt; plot(test(m)+r)  
  &gt; lines(smooth.spline(1:10,test(m)+r),col="red")  
  </code></pre>
  
  <p>So I've got the true function values at the 10 equally spaced points i.e. test(m). I just need a way to extract the smooth.spline values at those 10 points, then I should be able to calculate MSE.</p>