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
xtabs function. Arrays of counts without row, column and layer names will have letters attributed automatically; use
dimnames to change these names.
Main options common to several models include:
gnm: tolerance criterion (
tolerance), maximum number of iterations (
iterMax), progress output (
verbose), faster fitting by not estimating uninteresting parameters (
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.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:
main), axis labels (
ylab), axis limits (
ylim), symbol size (
cex) and type (
pch), draw onto an existing plot (
?plot.assoc for the full reference.
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.
weicommands or diagonal-specific parameters). Row-column intraction coefficients obtained with
weighting="none"are consistent with LEM (coefficients reported by LEM exclude the last row and column).
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:
ranat the end of the
cri 0.00000001line (or use an even lower value if time permits) to use a stricter criterion. Even then, check that changing the criterion does not affect too much the estimated coefficients: if that is the case, they may not be reliable.
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.
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).