Short Reference for logmult

Milan Bouchet-Valat


Supported Models and Options

The logmult package currently supports these model families via separate functions:

Please refer to the inline documentation for each function (e.g. ?unidiff) for more details and classic examples.

These functions take as their first argument a table, typically obtained via the table or xtabs function. Arrays of counts without row, column and layer names will have letters attributed automatically; use rownames, colnames and/or dimnames to change these names.

Main options common to several models include:

Custom models which cannot be obtained via the standard options can be fitted manually by calling gnm directly. Association coefficients can then be extracted by calling one of the assoc.* functions on the model: assoc.rc, assoc.rcL, assoc.rcL.symm, assoc.hmskew, assoc.hmskewL, assoc.rc.symm or assoc.yrcskew. Since these functions are not exported, you need to fully qualify them to call them, e.g. logmult:::assoc.rc(model). The resulting objects (of class assoc) can be passed to plot and support the same options as models.

Models of the “quasi-” type, i.e. excluding some cells of a table, can be fitted by setting the corresponding cells of the input table to NA. Reported degrees of freedom will be correct (contrary to what often happens when setting zero weights for these cells).


The package supports rich plotting features for each model family.

For the UNIDIFF model the layer coefficient can be plotted by simply calling plot on the fitted model. See ?plot.unidiff for details and examples.

For association models, one- and multi-dimensional scores plots can be drawn, again by calling plot on the fitted model. For models with a layer effect, a given layer can be chosen via the layer argument, or an average of association coefficients can be used (for models with homogeneous scores only). Several arguments allow tweaking the display, including:

See ?plot.assoc for the full reference.

Notes About LEM

Results provided by logmult should generally be consistent with LEM, and have been checked against it when possible. Some models are known not to work correctly in LEM, though.

Even when models are supposed to be consistent between LEM and logmult, it can happen that different results are obtained. There are several possible reasons to that:

When unsure whether parameters of a model are identified in LEM, add ran at the end of the mod line to use random starting values. Unidentified coefficients will then be different at every run; only identified coefficients will remain the same. logmult only reports identifiable parameters. On the other hand, gnm returns unidentified parameters from coef, but these have NA standard errors when calling summary(asGnm(model)); since random starting values are used by default, unidentified parameters will also be different when re-fitting a model.

When using null weights, LEM reports incorrect degrees of freedom, as zero-weight cells are still considered as free. With logmult, instead of using null weights, set corresponding cells to NA in the input table; this will report the same results as LEM, but with correct degrees of freedom.

logmult/gnm Limitations Compared With LEM

gnm and logmult do not always work well with effects coding ("contr.sum"). Models may fail to converge and parameters extraction will not always work. Using dummy coding ("contr.treatment") is recommended, and gives the same log-multiplicative parameters as when using effects coding (which only affects linear parameters).