[R] Strange predicted values ?

Prof Brian Ripley ripley at stats.ox.ac.uk
Thu Aug 7 17:23:24 CEST 2003


Let me remind you that originally you did not understand why the fitted
values did not match up with some other set of values of var1 to var4 you
cbind-ed.  You need to predict at those values for what *you* did not to
be `strange'.

Please do as I suggested and consult the documentation. 


On Thu, 7 Aug 2003, orkun wrote:

> Prof Brian Ripley wrote:
> 
> >On Thu, 7 Aug 2003, orkun wrote:
> >
> >[quoting me without attribution]
> >
> >  
> >
> >>>Those are not predicted values, they are fitted values.  Try predicting on 
> >>>the same set of variables as you printed.
> >>>      
> >>>
> >
> >Precisely!  From ?predict.glm
> >
> > newdata: optionally, a new data frame from which to make the
> >          predictions.  If omitted, the fitted linear predictors are
> >          used.
> >
> >[...]
> >
> >  
> >
> >>If  predict(glm.obj,type="resp") does not give predicted vals, How can I 
> >>get predicted values ?
> >>    
> >>
> >
> >Try reading the help page?  It is quite explicit, and has examples, as do 
> >all good books on S/R.
> >
> >  
> >
> I tried this:
> #I think since an interaction exists in glm.obj, data.frame.obj did not 
> not work
> #instead I used model.frame obj (it works)
> newdata<-model.frame(glm.obj)
> pr<-predict.glm(glm.obj,newdata,type="resp")
> it works but there was a warning message:
> prediction from a rank deficient fit may be misleading in predic.lm (....)
> 
> any suggestions ?

Follow advice when it is given to you.

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595




More information about the R-help mailing list