Skip to content
Prev 312146 / 398506 Next

GLM Coding Issue

Hi,

Comments inline:

On Tue, Nov 27, 2012 at 1:00 PM, Craig P O'Connell
<coconnell2 at umassd.edu> wrote:
It essentially makes a copy of `avoid` to `newavoid` -- what did you
want it to do?

That having been said, a good rule of thumb is to never use `attach`,
so let's avoid it for now.
`cbind`-ing doesn't make much sense here. What is your target (y)
variable here? are you trying to predict `avoid` or `noavoid` status?

Let's assume you were "predicting" `noavoid` from just `treatment` and
`feeding` (I guess you have more data (rows) than you show), you would
build a model like so:

R> model <- glm(noavoid ~ treatment + feeding, binomial, avoid)

Or to be explicit about the parameters:

R> model <- glm(noavoid ~ treatment + feeding, family=binomial, data=avoid)
Since you're just getting started, maybe it would be helpful for
people writing documentation/tutorials/whatever what needs to be
explained better.

For instance, I'm curious why you thought to `cbind` in your first glm
call, which was:

model1<-glm(cbind(avoid, noavoid)~treatment,data=,family=binomial)

What did you think `cbind`-ing was accomplishing for you? Is there an
example somewhere that's doing that as the first parameter to a `glm`
call?

Also, why just have `data=<nothing>`?

I'm not criticizing, just trying to better understand.

-steve