Hello I carried out a logistic regression and found predicted values. Then I want to see both predictors (var1,var2..) and predicted values in same matrix. In other words, I need to know each combinations and predicted values. I used: cbind(var1,var2,var3,var4,predict(glm.obj,type="resp")) I got a somewhat strange result: var1 var2 var3 var4 var5 var6 predicted vals ------ ----- ----- -------- ----- ----- ------------------- 6 6 1 1 1 1 4.24e-07 6 6 1 1 1 1 8.37e-11 6 6 1 1 1 1 6.8e-07 . . . I had expected to have a same predicted value for same combinations. Can anyone explain to me why ? Or any suggestion ? kind regards Ahmet Temiz TURKEY ______________________________________ ______________________________________ The views and opinions expressed in this e-mail message are ...{{dropped}}
Those are not predicted values, they are fitted values. Try predicting on the same set of variables as you printed. Please do try to give a small reproducible example so we can see what you actually did. On Thu, 7 Aug 2003, orkun wrote:> I carried out a logistic regression and found predicted values. > Then I want to see both predictors (var1,var2..) and predicted values > in same matrix. In other words, I need to know each combinations > and predicted values. > > I used: > cbind(var1,var2,var3,var4,predict(glm.obj,type="resp")) > > I got a somewhat strange result: > > var1 var2 var3 var4 var5 var6 predicted vals > ------ ----- ----- -------- ----- ----- ------------------- > 6 6 1 1 1 1 4.24e-07 > 6 6 1 1 1 1 8.37e-11 > 6 6 1 1 1 1 6.8e-07 > . > . > . > > I had expected to have a same predicted value for > same combinations.Yes, so it's a fair guess that is not what you computed. But, we can't tell what you did do. -- 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
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 ? thank you again ______________________________________ ______________________________________ The views and opinions expressed in this e-mail message are ...{{dropped}}