prior2macro: Translates informative prior information into a concise MLwiN macro.
Description
An internal function which takes an R list object containing informative
prior information for a multilevel model and translates it into a concise
vector object to be used in an MLwiN macro.Usage
prior2macro(prior, formula, levID, D, indata)
Arguments
prior
An R list object containing prior information for a multilevel
model. See `Details' below.
levID
A string vector specifying the level ID(s).
D
A character string/vector specifying the distribution of the
current model.
indata
A data.frame object containing the variables to be modelled.
Value
- A long vector is returned in the format of MLwiN macro language. This
includes all the specified prior parameters.
Details
The prior
list can contain the following:
fixe
: For the fixed
parameters, if proper normal priors are used for some parameters, a list of
vectors of length two is provided, each of which specifies the mean and the
standard deviation. If not given, default ('flat' or 'diffuse') priors are
used for the parameters.fixe.common
: For multivariate normal,
multinomial and mixed response models, if common coefficients are added, usefixe.common
rather thanfixe
.fixe.sep
: If the common
coefficients are added, usefixe.sep
for the separate coefficients.rp
: A list object specifying the Wishart or gamma prior for the
covariance matrix or scalar variance at the levels specified, e.g.rp1
for
level 1,rp2
for level 2, etc. Consists of: (1)estimate
-- an estimate for the true value of the inverse of the
covariance matrix; (2)size
-- the number of rows in the covariance
matrix. Note that this is a weakly-informative prior and the default prior
is used if missing.