Supports Formula syntax as used in earlier (<0.8-0) versions of R2MLwiN. A model
formula, as a formula object (or a character string) is translated into
an R list object. Called by runMLwiN
if oldsyntax = TRUE
(when user specifies levID
not NULL
in runMLwiN
function
call). For corresponding function supporting new syntax, see
Formula.translate
.
Formula.translate.compat(Formula, levID, D = "Normal", indata)
Outputs an R list object, which is then used as the input for
write.IGLS
and/or write.MCMC
.
A formula object (or a character string) specifying a
multilevel model. See Value
for details.
A character (vector) specifying the level ID(s).
A character string/vector specifying the distribution to be
modelled, which can include 'Normal'
(the default), 'Binomial'
,
'Poisson'
, 'Negbinom'
, 'Unordered Multinomial'
,
'Ordered Multinomial'
, 'Multivariate Normal'
, or 'Mixed'
.
A data.frame object containing the data to be modelled.
Zhang, Z., Charlton, C.M.J., Parker, R.M.A., Leckie, G., and Browne, W.J. (2016) Centre for Multilevel Modelling, University of Bristol.
If Formula
is a character string, then the following
syntax applies:
~
A tilde is used to separate response variable(s) and
explanatory variable(s).
()
Round brackets are used to specify each random
variable in the model together with its fixed/random part information.
|
Separates explanatory variable(s) (placed to the right of
|
) from the fixed/random part information (placed to the left of
|
) when placed within ()
.
[]
When placed
immediately after an explanatory variable, indicates that the variable is
categorical. The string in the []
represents the reference category;
if empty, no reference category is used; See note.
:
Indicates an interaction term: i.e. the variables adjacent to :
, and
separated by it, are interacted with each other.
0
When placed to the left of |
within ()
indicates that the variables
to the right of |
within the same ()
are to be added to the
fixed part of the model.
1
When placed to the left of
|
within ()
indicates that the coefficients of the variables
placed to the right of |
within the same ()
are to be allowed
to randomly vary at level 1 (and so on for 2
for level 2, 3
for level 3, etc.)
0s/0c
When placed to the left of |
within ()
indicates that separate (hence s
) / common (hence c
)
coefficients for the variables to the right of |
within the same
()
are to be added to the fixed part (hence 0
) of multivariate
normal, multinomial and mixed responses models.
2s/2c
When
placed to the left of |
within ()
indicates that separate
(hence s
) / common (hence c
) coefficients for the variables to
the right of |
within the same ()
are to be added to the
random part of the model, and allowed to vary at level 2; applies to
multivariate normal, multinomial and mixed responses models only.
{}
gives a vector of binary indicators specifying a
common coefficient. 1 is to include the component at the corresponding
positions; zero otherwise. These digits are separated by commas; applies to
multivariate normal, multinomial and mixed responses models only.
.
Used for adding a separate coefficient for a particular
component at a specific level; applies to multivariate normal, multinomial
and mixed responses models only
If Formula
is a formula object, 0s/0c
, 2s/2c
, .... and
{}
have to be replaced by `0s`/`0c`
, `2s`/`2c`
, ....
and ()
respectively. Other syntax remains the same.
runMLwiN
, write.IGLS
, write.MCMC
, Formula.translate