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:
RegModel.3 <- lm(ordercount~timecount2+timecount4 .... expeditedrop, data=Dataset)
Now I want to find the standard error of the forecast, like the stdf
function in stata, for each of the fitted values.
I've tried the following code:
predict(RegModel.3$fitted.values, new, se.fit=TRUE)
But I'm getting the following error:
Error in UseMethod("predict") : no applicable method for 'predict' applied to an object of class "c('double', 'numeric')"
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:
write.csv(RegModel.3$coefficients, file='results.csv')
Thanks!