Skip to content
Prev 554 / 7420 Next

log-linear model and log-likelihood ratio

Hi Marta,

IIRC, the LRT (which is the first of the 2 tests returned by the loglm
print method, and does use the G2 stat) compares the fitted model to
one that fits perfectly.  Your first model is saturated/fits
perfectly, and leaves no df for the test stat.  See code and output
below.

hth,

Kingsford Jones


 floodplain=data.frame(y=c(15,4,0, 13,8,17),
              position=gl(3,1,6, labels=c("bottom","middle","top")),
              dead_coli=gl(2,3,labels=c("with","without")))

 library(MASS)
 f1 <- loglm(y ~ position*dead_coli, floodplain)
 f2 <- loglm(y~ position + dead_coli, floodplain)
Re-fitting to get frequencies and fitted values
        dead_coli
position with without
  bottom    0       0
  middle    0       0
  top       0       0
[1] 0
[1] 0





On Sat, Feb 14, 2009 at 11:25 AM, Marta Rufino
<mrufino at cripsul.ipimar.pt> wrote: