Hi Romain,
It works for me:

model1 <- glm(as.vector(x) ~dept*sex*admit,poisson)
model1

Call:  glm(formula = as.vector(x) ~ dept * sex * admit, family = poisson)

Coefficients:
      (Intercept)              dept2              dept3              dept4
           dept5
          6.23832           -0.37186           -1.45083           -1.31107
        -2.26803
            dept6               sex2             admit2         dept2:sex2
      dept3:sex2

[trimmed]

Here is my sessionInfo():

R version 2.9.2 RC (2009-08-23 r49375)
i386-pc-mingw32

locale:
LC_COLLATE=English_United States.1252;LC_CTYPE=English_United
States.1252;LC_MONETARY=English_United
States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

other attached packages:
[1] lattice_0.17-25 combinat_0.0-6

loaded via a namespace (and not attached):
[1] grid_2.9.0  tools_2.9.0


HTH,
Jorge


On Sun, Oct 11, 2009 at 11:54 AM, romunov <> wrote:

> Dear List,
>
> I'm having problem with an exercise from The R book (M.J. Crawley) on page
> 567.
> Here is the entire code upto the point where I get an error.
>
> data(UCBAdmissions)
> x <- aperm(UCBAdmissions, c(2, 1, 3))
> names(dimnames(x)) <- c("Sex", "Admit?", "Department")
> ftable(x)
> fourfoldplot(x, margin = 2)
> dept<-gl(6,4)
> sex<-gl(2,1,24)
> admit<-gl(2,2,24)
> model1<-glm(as.vector(x) ~dept*sex*admit,poisson)
>
> This last line returns:
>
> Error in family$family : $ operator is invalid for atomic vectors
>
> I've searched older posts but found nothing that would help resolve my
> problem. Has anyone encountered anything similar and/or knows a fix?
>
> Cheers,
> Roman
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help@r-project.org 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.
>

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org 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