[R] Extract values from a predict() result... how?
Jay
josip.2000 at gmail.com
Mon Feb 15 22:35:17 CET 2010
Hello,
silly question I suppose, but somehow I can't manage to extract the
probabilities from a glm.predict() result:
> str(res)
Named num [1:9] 0.00814 0.01877 0.025 0.02941 0.03563 ...
- attr(*, "names")= chr [1:9] "1" "2" "3" "4" ...
I got from:
# A Gamma example, from McCullagh & Nelder (1989, pp. 300-2)
clotting <- data.frame(
u = c(5,10,15,20,30,40,60,80,100),
lot1 = c(118,58,42,35,27,25,21,19,18),
lot2 = c(69,35,26,21,18,16,13,12,12))
model <- glm(lot1 ~ log(u), data=clotting, family=Gamma)
res <- predict(model, clotting)
I want to transfer the probabilities "0.00814 0.01877 0.025 0.02941
0.03563 ..." to a separate vector, how do I do this?
More information about the R-help
mailing list