Learn R Programming

gRim (version 0.1.2)

effloglin: Fitting Log-Linear Models by Message Passing

Description

Fit log-linear models to multidimensional contingency tables by Iterative Proportional Fitting.

Usage

effloglin(table, margin, fit = FALSE, eps = 0.01, iter=20, print = TRUE)

Arguments

table
A contingency table
margin
A generating class for a hierarchical log--linear model
fit
If TRUE, the fitted values are returned.
eps
Convergence limit; see 'details' below.
iter
Maximum number of iterations allowed
print
If TRUE, iteration details are printed.

Value

  • A list with compnents
  • comp1Description of 'comp1'
  • comp2Description of 'comp2'
  • ...

Details

The function differs from loglin in that 1) data can be given in the form of a list of sufficient marginals and 2) the model is fitted only on the cliques of the triangulated interaction graph of the model. This means that the full table is not fitted, which means that effloglin is efficient (in terms of storage requirements). However effloglin is implemented entirely in R and is therefore slower than loglin.

See Also

loglin

Examples

Run this code
data(reinis)
glist <-list(c("smoke", "mental"), c("mental", "phys"), c("phys", "systol"
), c("systol", "smoke"))

stab <- lapply(glist, function(gg) tableMargin(reinis, gg))
fv3 <- effloglin(stab, glist, print=FALSE)

Run the code above in your browser using DataLab