3
我是来自Stata世界的R的新手。我刚刚运行的线性模型(具有约100个变量,各有500个数据点左右),像这样:预测预测的标准误差
RegModel.3 <- lm(ordercount~timecount2+timecount4 .... expeditedrop, data=Dataset)
现在我想找到预测的标准误差,如在Stata的stdf
功能,为每个拟合值。
我尝试下面的代码:
predict(RegModel.3$fitted.values, new, se.fit=TRUE)
但我发现了以下错误:
Error in UseMethod("predict") : no applicable method for 'predict' applied to an object of class "c('double', 'numeric')"
我在做什么错?此外,我怎么去类似的方式的方式使用write.csv命令导出输出我写的系数:
write.csv(RegModel.3$coefficients, file='results.csv')
谢谢!
当我使用预测(),我得到以下错误:错误predict.lm(RegModel.3,间隔=“预测”,se.fit = TRUE): 下标越界---你知道我为什么得到它吗? – Bryan
@ user1884063请发布一个[可重现的例子](http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) –
或至少告诉我们什么'str(RegModel .3)'是... –