write.IGLS is an internal function which creates an MLwiN macro file to fit a multilevel model using IGLS.
1 2 3 4 5 6 7 8  write.IGLS(indata, dtafile, oldsyntax = FALSE, resp, levID, expl, rp,
D = "Normal", nonlinear = c(0, 1), categ = NULL, notation = NULL,
nonfp = NA, clre = NULL, Meth = 1, extra = FALSE, reset,
rcon = NULL, fcon = NULL, maxiter = 20, convtol = 2,
mem.init = "default", optimat = FALSE, weighting = NULL,
fpsandwich = FALSE, rpsandwich = FALSE, macrofile, IGLSfile, resifile,
resi.store = FALSE, resioptions, debugmode = FALSE, startval = NULL,
namemap = sapply(colnames(indata), as.character), saveworksheet = NULL)

indata 
A data.frame object containing the data to be modelled. 
dtafile 
The name of the temporary file used to send the data to MLwiN, which is in Stata format (i.e. with extension .dta). 
oldsyntax 
Specified as 
resp 
A character string (vector) of the response variable name(s). 
levID 
A character string (vector) of the specified level ID name(s). The
ID(s) should be sorted in the descending order of levels (e.g.

expl 
A character string (vector) of explanatory (predictor) variable name(s). 
rp 
A character string (vector) of random part of random variable name(s). 
D 
A character string/vector specifying the type of distribution to be modelled, which
can include 
nonlinear 
A character vector specifying linearisation method for discrete
response models (see Chapter 9 of Rasbash et al 2012, and Goldstein 2011).

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),

notation 
Specifies the model subscript notation to be used in the
MLwiN equations window. 
nonfp 
Removes the fixed part of random variable(s). 
clre 
A matrix used to define which elements of the random effects matrix
to remove (i.e. hold constant at zero). Removes
from the random part at level <first row> the covariance matrix element(s)
defined by the pair(s) of rows <second row> <third row>. Each column
corresponds to a removed entry of the covariance matrix. See e.g. 
Meth 
Specifies which maximum likelihood estimation method to be used.
If 
extra 
If 
reset 
A vector of 
rcon 
Matrix specifying constraints on the random parameters as
specified in 
fcon 
Matrix specifying constraints on the fixed coefficients as
specified in 
maxiter 
Numeric value specifying the maximum number of iterations, from the start, before estimation halts. 
convtol 
Numeric value specifying the convergence criterion, as
specified in the 
mem.init 
If calling write.IGLS directly, if wish to use defaults, value needs to be
specified as 
optimat 
This option instructs MLwiN to limit the maximum matrix size
that can be allocated by the (R)IGLS algorithm. Specify 
weighting 
A list of two items, one of which is a list called 
fpsandwich 
Specifies standard error type for fixed parameters. If

rpsandwich 
Specifies standard error type for random parameters. If

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 parameter estimates will be saved. The default location is in the temporary folder. 
resifile 
A file name where the residuals will be saved. The default location is in the temporary folder. 
resi.store 
A logical value to indicate if the residuals are to be
stored ( 
resioptions 
A string vector to specify the various residual options.
The 
debugmode 
A logical value determining whether MLwiN is run in the
background or not. The default value is 
startval 
A list of numeric vectors specifying the starting values.

namemap 
A mapping of column names to DTA friendly shorter names 
saveworksheet 
A file name used to store the MLwiN worksheet after the model has been estimated. 
Outputs a modified version of namemap containing newly generated short names.
Zhang, Z., Charlton, C.M.J., Parker, R.M.A., Leckie, G., and Browne, W.J. (2016) Centre for Multilevel Modelling, University of Bristol.
Goldstein, H. (2011) Multilevel Statistical Models. 4th Edition. London: John Wiley and Sons.
Rasbash, J., Steele, F., Browne, W.J. and Goldstein, H. (2012) A User's Guide to MLwiN Version 2.26. Centre for Multilevel Modelling, University of Bristol.
Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.
Please suggest features or report bugs with the GitHub issue tracker.
All documentation is copyright its authors; we didn't write any of that.