Formula.translate.compat {R2MLwiN}R Documentation

An internal function, allowing back-compatibility, which translates a model formula from a formula object or character string into an R list object.

Description

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.

Usage

Formula.translate.compat(Formula, levID, D = "Normal", indata)

Arguments

Formula

A formula object (or a character string) specifying a multilevel model. See Value for details.

levID

A character (vector) specifying the level ID(s).

D

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'.

indata

A data.frame object containing the data to be modelled.

Details

If Formula is a character string, then the following syntax applies:

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.

Value

Outputs an R list object, which is then used as the input for write.IGLS and/or write.MCMC.

Note

Note that some characters listed above have special meanings in the formula, so avoid using them when you name the random variable. Alphanumeric characters (i.e. [:alnum:]) are recommended for naming the random variable. They are also recommended for naming a reference category, inside []. Note: use [] notation only in the fixed part when there is no categorical variable in the random effects. If there is one in the random part, the categorical variable has to be converted into a set of binary variables (e.g., using Untoggle).

Author(s)

Zhang, Z., Charlton, C.M.J., Parker, R.M.A., Leckie, G., and Browne, W.J. (2016) Centre for Multilevel Modelling, University of Bristol.

See Also

runMLwiN, write.IGLS, write.MCMC, Formula.translate


[Package R2MLwiN version 0.8-9 Index]