The logmult package currently supports these model families via separate functions:
unidiff
function.rc
function.rcL
function.hmskew
function.hmskewL
function.yrcskew
function.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:
weighting
argument.symmetric
argument.layer.effect
, layer.effect.symm
and layer.effect.skew
arguments.nd
, nd.symm
and nd.skew
arguments.diagonal
argument.se
and nreplicates
argument.rowsup
and colsup
arguments.start
argument.gnm
: tolerance criterion (tolerance
),
maximum number of iterations (iterMax
), progress output (trace
and verbose
),
faster fitting by not estimating uninteresting parameters (elim
).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:
dim
argument.what
argument.what
argument.which
argument.conf.int
and replicates
argument.mass
argument.luminosity
argument.rev.axes
argument.main
), axis labels (xlab
, ylab
),
axis limits (xlim
, ylim
), symbol size (cex
) and type (pch
), draw onto an existing
plot (add
).See ?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.
wei
commands or diagonal-specific parameters).
Row-column intraction coefficients obtained with weighting="none"
or weighting="uniform"
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:
ran
at the end of the mod
line.cri 0.00000001
line (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).
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.