# [S] How can I get standard errors with predict?

George W. Gilchrist (gilchgw@u.washington.edu)
Tue, 21 Apr 1998 09:04:03 -0700

I've been scratching my head over this one for several days now and an
earlier posting yielded not one comment. Can anyone tell me why the
following code generates an error message when I call predict with the
se.fit=T option? All this talk about how useful standard errors would be for
other methods of predict makes me think how useful they would be for the
methods that allegedly can produce SE's! What is this "return.cov" that the
function cannot find? Obviously I must not be doing something that needs to
be done here. Anyone have a clue as to what it is?

> tmp1<-rep(1:20, times=rep(3, 20))
> tmp2<-sort(rnorm(60))
> tmp3<-lm(tmp2~tmp1)
> summary(tmp3)

Call: lm(formula = tmp2 ~ tmp1)
Residuals:
Min 1Q Median 3Q Max
-0.9712 -0.1927 0.0126 0.1366 0.9962

Coefficients:
Value Std. Error t value Pr(>|t|)
(Intercept) -1.7200 0.0726 -23.6781 0.0000
tmp1 0.1680 0.0061 27.7064 0.0000

Residual standard error: 0.2708 on 58 degrees of freedom
Multiple R-Squared: 0.9298
F-statistic: 767.6 on 1 and 58 degrees of freedom, the p-value is 0

Correlation of Coefficients:
(Intercept)
tmp1 -0.8765
> tmp4<-predict(tmp3, se.fit=T)
Error in get.default("return.cov", frame = 1): Object "return.cov" not found
Dumped
> tmp4<-predict.lm(tmp3, se.fit=T)
Error in get.default("return.cov", frame = 1): Object "return.cov" not found
Dumped
> tmp4<-predict.glm(tmp3, se.fit=T)
Error in get.default("return.cov", frame = 1): Object "return.cov" not found
Dumped
> tmp4<-predict.gam(tmp3, type="response", se.fit=T)
Error in get.default("return.cov", frame = 1): Object "return.cov" not found
Dumped
=======================================================
George W. Gilchrist gilchgw@u.washington.edu
University of Washington Phone:(206)543-4859
Dept. of Zoology, Box 351800 FAX:(206)543-3041
Seattle, WA 98l95-1800

-----------------------------------------------------------------------
This message was distributed by s-news@wubios.wustl.edu. To unsubscribe
send e-mail to s-news-request@wubios.wustl.edu with the BODY of the
message: unsubscribe s-news