[R] GLM Coding Issue
Steve Lianoglou
mailinglist.honeypot at gmail.com
Wed Nov 28 03:51:54 CET 2012
Hi Peter,
On Tue, Nov 27, 2012 at 8:05 PM, Peter Ehlers <ehlers at ucalgary.ca> wrote:
>
> On 2012-11-27 14:34, Steve Lianoglou wrote:
[snip]
> Steve:
> re a matrix response: see MASS (the book, 4ed) page 191; also found
> in the ch07.R file in the /library/MASS/scripts folder. I seem to
> recall that this is mentioned somewhere in the docs, but put my finger
> on it now.
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
--
Steve Lianoglou
Graduate Student: Computational Systems Biology
| Memorial Sloan-Kettering Cancer Center
| Weill Medical College of Cornell University
Contact Info: http://cbio.mskcc.org/~lianos/contact
More information about the R-help
mailing list