From: Ross Darnell
Liaw, Andy wrote:
From: Ross Darnell
A good point but what is the value of storing a large set of
predicted
values when the values of the explanatory variables are lost
(predicted
values of what?). I thought the purpose of objects was that
self explanatory (pardon the pun).
Maybe we could make it optional.
If what you are looking for is a way to track the
observations, I'd suggest
simply adding rownames of newdata as names of the predicted
values. Storing
names is much cheaper than the entire data frame of
predictors. (And in R,
data frames _must_ have unique row names.)
And as a matter of fact, predict.lm() and predict.glm()
(and probably most other predict() methods) already do
that.
Andy
Ross Darnell
--
Email: <r.darnell@uq.edu.au>
Hi Andy
Where?
Try predict.glm example
## example from Venables and Ripley (2002, pp. 190-2.)
ldose <- rep(0:5, 2)
numdead <- c(1, 4, 9, 13, 18, 20, 0, 2, 6, 10, 12, 16)
sex <- factor(rep(c("M", "F"), c(6, 6)))
SF <- cbind(numdead, numalive=20-numdead)
budworm.lg <- glm(SF ~ sex*ldose, family=binomial)
ld <- seq(0, 5, 0.1)
row.names(predict(budworm.lg, data.frame(ldose=ld,
sex=factor(rep("M", length(ld)), levels=levels(sex))),
type = "response"))