Bill.Venables@csiro.au
2003-Oct-30 01:56 UTC
[R] loglm() uses only a reference to data, and not data itsel f - is that on purpose??
loglm() is a port of an original written for S-PLUS. The fact that it carries only a reference to the data frame is neither intentional nor unintentional, but an unnoticed side-effect. I can see advantages both ways. (I'm not so sure, either, that what you say is standard behaviour for model fitting functions really is so universal.) It would not be too hard to come up with a version that embeds the data frame in the fitted model object, but if you are dealing with a really huge data set (the kind that loglm() was designed to handle, after all) do you really want to be carting around several copies of it around in memory? That said, do you have a suggested patch that might accommodate this refinement? Bill Venables. -----Original Message----- From: S?ren H?jsgaard [mailto:Soren.Hojsgaard at agrsci.dk] Sent: Thursday, October 30, 2003 8:10 AM To: r-help at stat.math.ethz.ch Subject: [R] loglm() uses only a reference to data, and not data itself - is that on purpose?? Dear all, Consider the following: library(MASS); data(HairEyeColor) l1 <- loglm(~ 1+2+3, data=HairEyeColor) myloglm <- function(){ nd <- HairEyeColor v <- loglm(~ 1+2+3, data=nd) return(v) } l2 <- myloglm() Now, step(l1) works, whereas step(l2) does not, the problem being that data nd does not exist outside myloglm. I was under the impression that objects from functions like glm() and lm() "carried their data" with them, but that does not seem to be the case for loglm(). Is there a reason for these different behaviours?? Thanks in advance S?ren H?jsgaard ______________________________________________ R-help at stat.math.ethz.ch mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help