title: Predicting standard errors of forecast
body: <p>I'm a newbie to R, coming from the Stata world.  I've just run a linear model (with approx 100 variables, each with 500 data points or so) like so:</p>
  
  <pre><code>RegModel.3 &lt;- lm(ordercount~timecount2+timecount4 .... expeditedrop, data=Dataset)
  </code></pre>
  
  <p>Now I want to find the standard error of the forecast, like the <code>stdf</code> function in stata, for each of the fitted values.</p>
  
  <p>I've tried the following code:</p>
  
  <pre><code>predict(RegModel.3$fitted.values, new, se.fit=TRUE)
  </code></pre>
  
  <p>But I'm getting the following error:</p>
  
  <pre><code>Error in UseMethod("predict") : no applicable method for 'predict' applied to an object of class "c('double', 'numeric')"
  </code></pre>
  
  <p>What am I doing wrong?  Also, how do I go about exporting the output using the write.csv command in a manner similar to the way I wrote the coefficients:</p>
  
  <pre><code>write.csv(RegModel.3$coefficients, file='results.csv')
  </code></pre>
  
  <p>Thanks!</p>