If we check the data, we see a mistake in the entry. > tbl.8.3 mara cig alc count 1 Yes Yes Yes 911 2 No No No 538 3 Yes Yes Yes 44 4 No No No 456 5 Yes Yes Yes 3 6 No No No 43 7 Yes Yes Yes 2 8 No No No 279
Try: table8.3 <- read.table(textConnection("alc cig mar count Yes Yes Yes 911 Yes Yes No 538 Yes No Yes 44 Yes No No 456 No Yes Yes 3 No Yes No 43 No No Yes 2 No No No 279"),header=TRUE) closeAllConnections() myglm <- glm(count ~ mar+cig+alc, family=poisson, data=table8.3) myglm$fitted.values > myglm$fitted.values 1 2 3 4 5 6 7 8 539.98258 740.22612 282.09123 386.70007 90.59739 124.19392 47.32880 64.87990 This reproduces the fitted values for your example (Agresti, pg 323) On Wed, Jan 14, 2009 at 7:23 AM, Gerard M. Keogh <gmke...@justice.ie> wrote: > > Dear all, > > sorry to bother you all with this but I've been trying to use the loglm in > MASS package (v2.8.0) and cannot get any sensible output. > I'm wondering am I doing something very foolish or missing something > obvious. > > For example, I tried the documentation help(loglm) example - here's the > code > > # Case 1: frequencies specified as an array. > sapply(minn38, function(x) length(levels(x))) > ## hs phs fol sex f > ## 3 4 7 2 0 > minn38a <- array(0, c(3,4,7,2), lapply(minn38[, -5], levels)) > minn38a[data.matrix(minn38[,-5])] <- minn38$fol > fm <- loglm(~1 + 2 + 3 + 4, minn38a) # numerals as names. > deviance(fm) > > [1] 0 > > The deviance is zero. > I tried other examples as well (Laura Thompson) and get pretty much > nonsense. > > E.g. > > library(MASS) > options(contrasts=c("contr.treatment", "contr.poly")) > tbl.8.3 = data.frame(mara > =factor(c("Yes","No"),levels=c("Yes","No")), > cig > =factor(c("Yes","No"),levels=c("No","Yes")), > alc > =factor(c("Yes","No"),levels=c("Yes","No")), > count=c(911,538,44,456,3,43,2,279) ) > fit.acm = loglm( count ~ alc*cig*mara,data=tbl.8.3, param=T, fit=T) > > > Any advice greatly appreciated. > > Gerard > > > > ********************************************************************************** > The information transmitted is intended only for the person or entity to > which it is addressed and may contain confidential and/or privileged > material. Any review, retransmission, dissemination or other use of, or > taking of any action in reliance upon, this information by persons or > entities other than the intended recipient is prohibited. If you received > this in error, please contact the sender and delete the material from any > computer. It is the policy of the Department of Justice, Equality and Law > Reform and the Agencies and Offices using its IT services to disallow the > sending of offensive material. > Should you consider that the material contained in this message is > offensive you should contact the sender immediately and also mailminder[at] > justice.ie. > > Is le haghaidh an duine nó an eintitis ar a bhfuil sí dírithe, agus le > haghaidh an duine nó an eintitis sin amháin, a bheartaítear an fhaisnéis a > tarchuireadh agus féadfaidh sé go bhfuil ábhar faoi rún agus/nó faoi > phribhléid inti. Toirmisctear aon athbhreithniú, atarchur nó leathadh a > dhéanamh ar an bhfaisnéis seo, aon úsáid eile a bhaint aisti nó aon ghníomh > a dhéanamh ar a hiontaoibh, ag daoine nó ag eintitis seachas an faighteoir > beartaithe. Má fuair tú é seo trí dhearmad, téigh i dteagmháil leis an > seoltóir, le do thoil, agus scrios an t-ábhar as aon ríomhaire. Is é beartas > na Roinne Dlí agus Cirt, Comhionannais agus Athchóirithe Dlí, agus na > nOifígí agus na nGníomhaireachtaí a úsáideann seirbhísí TF na Roinne, > seoladh ábhair cholúil a dhícheadú. > Más rud é go measann tú gur ábhar colúil atá san ábhar atá sa > teachtaireacht seo is ceart duit dul i dteagmháil leis an seoltóir > láithreach agus le mailminder[ag]justice.ie chomh maith. > > *********************************************************************************** > > > > ______________________________________________ > 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<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.