# Re: [R] question about se of predicted glm values

From: Berwin A Turlach <berwin_at_maths.uwa.edu.au>
Date: Tue, 06 May 2008 12:14:08 +0800

G'day Jarrett,
> tapply(y,x,mean)

a b
1.00 25.58
On Mon, 5 May 2008 20:21:26 -0700
Jarrett Byrnes <jebyrnes_at_ucdavis.edu> wrote:

> Hey, all. I had a quick question about fitting new glm values and
> then looking at the error around them. I'm working with a glm using
> a Gamma distribution and a log link with two types of treatments.
> However, when I then look at the predicted values for each category,
> I find for the one that is close to 0,

And this does not surprise you, since with your data:

a b
1.00 25.58

So wouldn't you expect one predicted value to be close to 1 instead of zero?

> the error (using se.fit=T with predicted) actually makes it overlap
> 0. This is not possible, as non-0 values have no meaning.
>
> Am I missing something in the interpretation?

Yes. :)

For GLMs, predict returns by default the predicted values on the linear predictor scale, not on the response scale. Negative values for the linear predictor are, of course, possible and may have meaning.

Look closely at the pictures that you have created. In the first one, for x=b, the values are around 30, in the picture with the fitted value the prediction for x=b is around 3; clearly another scale (namely the scale of the linear predictor).

> #get predicted values and their error
> a.fit<-predict(my.glm, data.frame(x="a"), se.fit=T)
> b.fit<-predict(my.glm, data.frame(x="b"), se.fit=T)

Try:

a.fit<-predict(my.glm, data.frame(x="a"), se.fit=T, type="response") b.fit<-predict(my.glm, data.frame(x="b"), se.fit=T, type="response")

Hope this helps.

Best wishes,

Berwin

• Full address ============================= Berwin A Turlach Tel.: +65 6515 4416 (secr) Dept of Statistics and Applied Probability +65 6515 6650 (self) Faculty of Science FAX : +65 6872 3919 National University of Singapore 6 Science Drive 2, Blk S16, Level 7 e-mail: statba_at_nus.edu.sg Singapore 117546 http://www.stat.nus.edu.sg/~statba

R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Tue 06 May 2008 - 04:18:15 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 06 May 2008 - 06:30:35 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.