Skip to content
Prev 260097 / 398502 Next

Post-hoc tests in MASS using glm.nb

Folks:
Yes. But perhaps it might be useful to flesh this out with a bit of
commentary. To this end, I invite others to correct or clarify the
following.

The potential "confusion" comes from requiring R to search for the
data. There is a rigorous process by which this is done, of course,
but it requires that the runtime environment be consistent with that
process, and the programmer who wrote the code may not have control
over that environment. The usual example is that one has an object
named,say,  "a" in the formula and in the attached data and another
"a" also in the global environment. Then the wrong "a" would be found.
The same thing can happen if another data set gets attached in a
position before the one of interest. (Like Peter, I haven't used
attach() in so long that I don't know whether any warning messages are
issued in such cases).

Using the "data = " argument when available or the with() function
when not avoids this potential confusion and tightly couples the data
to be analyzed with the analysis.

I hope this clarifies the previous posters' comments.

Cheers,
Bert