[R] loglm() uses only a reference to data, and not data itsel f - is that on purpose??
Bill.Venables@csiro.au
Bill.Venables at csiro.au
Thu Oct 30 02:56:52 CET 2003
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
More information about the R-help
mailing list