Usage
MacroScript2(indata, dtafile, resp,
levID, expl, rp,
D, nonlinear, categ,
notation, nonfp, clre,
smat, Meth, merr, seed,
iterations, burnin, scale,
thinning, priorParam, refresh,
fixM, residM, Lev1VarM,
OtherVarM, adaption, priorcode,
rate, tol, lclo,
mcmcOptions, fact,
xclass = NULL, BUGO = NULL,
mem.init, nopause,
modelfile = modelfile,
initfile = initfile,
datafile = datafile,
macrofile = macrofile,
IGLSfile = IGLSfile,
MCMCfile = MCMCfile,
chainfile = chainfile,
MIfile = MIfile,
resifile = resifile,
resi.store = resi.store,
resioptions=resioptions,
resichains = resichains,
FACTchainfile = FACTchainfile,
resi.store.levs = resi.store.levs,
debugmode = debugmode,
startval = startval,
dami = dami)
Arguments
indata
A data.frame object containing the data to be modelled.
dtafile
The file name of the dataset to be imported into MLwiN, which is in Stata format (i.e. with extension .dta).
resp
A character string (vector) of response variable(s).
levID
A character string (vector) of the specified level ID(s). The ID(s) should be sorted in the descending order of levels (e.g. levID=c('level2','level1')
where 'level2'
is the higher level).
expl
A character string (vector) of explanatory (predictor) variable(s).
rp
A character string (vector) of random part of random variable(s).
D
A vector specifying the type of distribution to be modelled, which can include "Normal"
, "Binomial"
"Poisson"
, "Unordered Multinomial"
, "Ordered Multinomial"
, "Multivariate Normal"
nonlinear
LINEarise mode N order M. N=0
specifies marginal quasi-likelihood linearization (MQL), whilst N=1
specifies penalised quasi-likelihood linearization (PQL); M=1
specifies first order approximation, whilst M=2
categ
Specifies categorical variable(s) as a matrix. Each column corresponds to a categorical variable; the first row specifies the name(s) of variable(s);
the second row specifies the name(s) of reference group(s), NA
(s) if no reference group; th
notation
Specifies the model subscript notation to be used in the MLwiN equations window. "class"
means no multiple subscripts, whereas "level"
has multiple subscripts.
nonfp
Removes the fixed part of random variable(s). NA
if no variable is removed.
clre
A matrix used to estimate some, but not all, of the variances and covariances for a set of coefficients at a particular level. Remove from the random part at level the covariance matrix element(s) defined by the pair(s) of rows
smat
An integer vector of length 2 specifying whether the covariance matrix at a particular level is diagonal. The first digit is the level indicator, whilst the second digit is a binary indicator where 1
indicates a diagonal covariance matrix and
Meth
Specifies which maximum likelihood estimation method to be used. If Meth=0
estimation method is set to RIGLS. If Meth=1
estimation method is set to IGLS (the default setting). If Meth
is absent, alternate between IGL
merr
A vector which sets-up measurement errors on predictor variables. The first element N
defines the number of variables that have measurement errors. Then, for each variable with measurement error, a pair of inputs is required: value Ma is the
seed
An integer specifying the random seed in MLwiN. By default, seed=1
.
iterations
An integer specifying the number of iterations after burn-in.
burnin
An integer specifying length of the burn-in.
scale
An integer specifying the scale factor.
thinning
An integer specifying the frequency with which successive values in the Markov chain are stored. By default thinning=1
.
priorParam
A vector specifying the informative priors used. Also see prior2macro
. refresh
An integer specifying how frequently the parameter estimates are refreshed on the screen during iterations. By default refresh=50
.
fixM
Specifies the fixed effect method: 1
for Gibbs Sampling, 2
for univariate MH Sampling and 3
for multivariate MH Sampling.
residM
Specifies the residual method: 1
for Gibbs Sampling, 2
for univariate MH Sampling and 3
for multivariate MH Sampling.
Lev1VarM
Specifies the level 1 variance method: 1
for Gibbs Sampling, 2
for univariate MH Sampling and 3
for multivariate MH Sampling.
OtherVarM
Specifies the variance method for other levels: 1
for Gibbs Sampling, 2
for univariate MH Sampling and 3
for multivariate MH Sampling.
adaption
adaption=1
indicates adaptation is to be used; 0
otherwise.
priorcode
An integer indicating which default priors are to be used for the variance parameters. This parameter takes the value 1
for Gamma priors or 0
for Uniform on the variance scale priors. See the section on "Priors" in the MLwiN help
rate
An integer specifying the acceptance rate (as a percentage); this command is ignored if adaptation=0
.
tol
An integer specifying tolerance.
lclo
This command toggles on/off the possible forms of complex level 1 variation when using MCMC. By default (lclo=0
) we express the level 1 variation as a function of the predictors.
If this is toggled (lclo=1
) we express the log of
mcmcOptions
A list of other MCMC options used. See Value below.
fact
A list of objects specified for factor analysis. See Value below.
xclass
A list of objects specified for cross-classified and/or multiple membership models. See Value below.
BUGO
If the first entry of the vector is TRUE
, the current model is outputted in BUGS code. version=4
specifies WinBUGS 1.4 format, whilst version=3
corresponds to WinBUGS 1.3 format. n.chains
specifies the n
mem.init
A vector which sets and displays worksheet capacities for the current MLwiN session according to the value(s) specified. By default, the number of levels is nlev
+1; worksheet size in thousands of cells is 6000; the number of columns is 2500;
nopause
A logical value specifying whether the estimates are to be updated on screen or not, in MLwiN. Default nopause=FALSE
, i.e. the screen is updated.
modelfile
A file name where the WinBUGS model will be saved in .txt format.
initfile
A file name where the WinBUGS initial values will be saved in .txt format.
datafile
A file name where the WinBUGS data will be saved in .txt format.
macrofile
A file name where the MLwiN macro file will be saved. The default location is in the temporary folder.
IGLSfile
A file name where the IGLS estimates will be saved. The default location is in the temporary folder.
MCMCfile
A file name where the MCMC estimates will be saved. The default location is in the temporary folder.
chainfile
A file name where the MCMC chains will be saved. The default location is in the temporary folder.
MIfile
A file name where the missing values will be saved. The default location is in the temporary folder.
resifile
A file name where the residual estimates will be saved. The default location is in the temporary folder.
resi.store
A logical value to indicate if residuals are to be stored (TRUE
) or not (FALSE
).
resioptions
A string vector to specify the various residual options. The "variances"
option calculates the posterior variances instead of the posterior standard errors; the "standardised"
, "leverage"
, "influence"
an
resichains
A file name where the residual chains will be saved. The default location is in the temporary folder.
FACTchainfile
A file name where the factor chains will be saved. The default location is in the temporary folder.
resi.store.levs
An integer vector indicating the levels at which the residual chains are to be stored.
debugmode
A logical value determining whether MLwiN is run in the background or not. The default value is FALSE
: i.e. MLwiN is run in the background. If TRUE
MLwiN remains open after the model has run, allowing the user to interact with ML
startval
A list of numeric vectors specifying the starting values when using MCMC. FP.b
corresponds to the estimates for the fixed part; FP.v
specifies the variance/covariance estimates for the fixed part; RP.b
specifies the
dami
This command outputs a complete (i.e. including non-missing responses) response variable y. If dami=c(0,,,...)
then the response variables returned will be the value of y at the iterations quoted (as integers ,