Skip to content
Prev 312163 / 398506 Next

GLM Coding Issue

Hi Peter,
On Tue, Nov 27, 2012 at 8:05 PM, Peter Ehlers <ehlers at ucalgary.ca> wrote:
[snip]
Indeed -- thanks for the pointer.

Well then ... let me try to recover and at least offer some decent
advice to Craig's original post.

I'd still recommend avoiding the use of `attach` and favor passing in
your data data.fame using the `data` param of the call to `glm`.

I'd also call the `avoid` data.frame something else, to avoid
potential confusion (if only in your mind) with the column `avoid`
inside the `avoid` data.frame.

Anyhow, when you pass in your data as param, things work ok:

R> model1 <- glm(cbind(avoid, noavoid) ~ treatment, binomial, avoid)
R> summary(model1)

Call:
glm(formula = cbind(avoid, noavoid) ~ treatment, family = binomial,
    data = avoid)

Deviance Residuals:
    Min       1Q   Median       3Q      Max
-3.6480  -1.3350   0.4297   1.5706   2.6200

...

OK ... well, hope that helped somewhat.

-steve