loglm
allows dimension numbers to be used in place of names in
the formula. denumerate
modifies such a formula into one that
terms
can process.denumerate(x)
loglm
, that is, it
may allow dimension numbers to stand in for names when specifying
a log-linear model.n
, have been used to specify fixed
margins these are replaced by names of the form .vn
which may
be processed by terms
.loglm
fits log-linear models to
frequency data using iterative proportional scaling. To specify
the model the user must nominate the margins in the data that
remain fixed under the log-linear model. It is convenient to
allow the user to use dimension numbers, 1, 2, 3, ...for the
first, second, third, ..., margins in a similar way to variable
names. As the model formula has to be parsed by terms
, which
treats 1
in a special way and requires parseable variable names,
these formulae have to be modified by giving genuine names for
these margin, or dimension numbers. denumerate
replaces these
numbers with names of a special form, namely n
is replaced by
.vn
. This allows terms
to parse the formula in the usual way.renumerate
denumerate(~(1+2+3)^3 + a/b)
~ (.v1 + .v2 + .v3)^3 + a/b
Run the code above in your browser using DataLab