[R] predicting glm on a new dataset

From: Christian Jones <ccatj_at_web.de>
Date: Sat 25 Feb 2006 - 01:33:13 EST

Hello together,

I would like to predict my fitted values on a new dataset. The original dataset consists of the variable a and b (data.frame(a,b)). The dataset for prediction consists of the same variables, but variable b has a constant value (x) added towards it (data.frame (a,b+x).

The prediction command returns the identical set of predicted values as for the original dataset yet I would have expected them to change due to b+x.

Were have I gone wrong?

Heres my code:

orig.frame<-data.frame(y,a,b)

pred.frame<-data.frame(a,b+x)

attach(orig.frame)

modela<-glm(y~a+b,binomial)

pr<-predict(modela,newdata=pred.frame,type="response")

many thanks

Chris         

        [[alternative HTML version deleted]]



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Sat Feb 25 01:53:11 2006

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:42:45 EST