David Winsemius <dwinsem...@comcast.net> writes: > On Sep 7, 2010, at 11:02 AM, Johann Hibschman wrote: >> Even so, I would prefer to only save the coefficients > > Have you read through the Value section of glm's help page? > > ...and > > ?coef
I have; it's easy to get the coefficients. The part I'm struggling with is reconstituting an operational glm object given the coefficient vector and the formula. Really, I was hoping that someone had already done this work, so I could stop trying re-create the right kind of term object, while making sure it doesn't hold on to a pointer to an environment with a lot of data in it, etc., etc.. > The predict.glm function is visible so you can just type its name to > see the code. It appears that the section of the code that does the > work is fairly short. This is my nomination for what happens in most > cases: > if (!se.fit) {# not generally invoked with se.fit=TRUE > } > else { > pred <- predict.lm(object, newdata, se.fit, scale = 1, > type = ifelse(type == "link", "response", type), > terms = terms, na.action = na.action) > switch(type, response = { > pred <- family(object)$linkinv(pred) > }, link = , terms = ) > } I agree. That reduces the problem to confecting a working lm object, given a formula and coefficients. Unfortunately, I haven't yet figured out how to do that. > So maybe you should write a predict function that would work on a > reduced glm object that has a class name of your choosing. I'm trying to get this to work, but I haven't figured out yet how to generate the X matrix properly from the formula and the coefficients. I'm sure I can eventually get it, but it's annoying. The whole model whereby fit objects keep around their data so you don't have to provide it on a few calls just seems like a mistake. -Johann ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.