In a function I'm writing, I want to handle a variety of families of glm() and related models including MASS::glm.nb() and hopefully countreg::hurdle(), zeroinfl(). A central part of the function
is a switch() call

    family <- object$family$family
    switch(family,
            "binomial" = {
                },
            "quasibinomial" = {
                },
            "poisson" = {
                },
            "quasipoisson" = {
                },
            "gaussian" = {
                }
            )

But I discovered that the object$family$family slot doesn't work the same way with glm.nb --
I get, e.g.,
> nmes.nbin2$family$family
[1] "Negative Binomial(1.2354)"
and the countreg functions don't return a family component.

I think I have to also use class(object), and a more complicated computation of family,
but maybe there's a simpler way?

-Michael

--
Michael Friendly     Email: friendly AT yorku DOT ca
Professor, Psychology Dept. & Chair, Quantitative Methods
York University      Voice: 416 736-2100 x66249 Fax: 416 736-5814
4700 Keele Street    Web:   http://www.datavis.ca
Toronto, ONT  M3J 1P3 CANADA

______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to