[R] logistic regression - what is being predicted when using predict - probabilities or odds?

Dimitri Liakhovitski ld7631 at gmail.com
Thu Feb 18 19:58:57 CET 2010


Dear gurus,
I've analyzed a (fake) data set ("data") using logistic regression (glm):

logreg1 <- glm(z ~ x1 + x2 + y, data=data, family=binomial("logit"),
na.action=na.pass)

Then, I created a data frame with 2 fixed levels (0 and 1) for each predictor:

attach(data)
x1<-c(0,1)
x2<-c(0,1)
y<-c(0,1)
newdata1<-data.frame(expand.grid(x1,x2,y))
names(newdata1)<-c("x1","x2","y")

Finally, I calculated model-predicted probabilities for each
combination of those fixed levels:

newdata1$predicted <-predict(logreg1,newdata=newdata1, type="response")

I am pretty sure the results I get (see the table below) are actual
probabilities. But just in case - could someone please confirm that
these are probabilities rather than log odds or odds?
Thanks a lot!

x1 x2 y predicted
1  0  0 0   0.08700468
2  1  0 0   0.19262901
3  0  1 0   0.27108334
4  1  1 0   0.48216220
5  0  0 1   0.53686154
6  1  0 1   0.74373367
7  0  1 1   0.81896484
8  1  1 1   0.91887072
-- 
Dimitri Liakhovitski

Dimitri.Liakhovitski at ninah.com



More information about the R-help mailing list