[R] predict.lm

Bill Szkotnicki bszk at uoguelph.ca
Tue May 2 20:58:44 CEST 2006

I have a model with a few correlated explanatory variables.
> m1=lm(y~x1+x2+x3+x4,protdata)
and I have used predict as follows:

> x=data.frame(x=1:36)
> yp=predict(m1,x,se.fit=T) 
> tprot=sum(yp$fit) # add up the predictions
> tprot

tprot is the sum of the 36 predicted values and I would like the se of that
I think  
> sqrt(sum(yp$se.fit^2))
is not correct.

Would anyone know the correct approach?
i.e. How to get the se of a function of predicted values (in this case sum)
Thanks, Bill

More information about the R-help mailing list