Søren Højsgaard
2003-Oct-29 22:10 UTC
[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