Learn R Programming

R2MLwiN (version 0.1-7)

mlwin2bugs: This function captures output files from MLwiN for estimation in WinBUGS/OpenBUGS.

Description

This function allows R to call WinBUGS using the output files from MLwiN. This function uses functionalities in the rbugs package.

Usage

mlwin2bugs(D, levID, datafile, initfile, modelfile, bugEst, fact, addmore, 
n.chains, n.iter, n.burnin, n.thin, debug = F, bugs, 
bugsWorkingDir = tempdir(), OpenBugs = F, cleanBugsWorkingDir = FALSE, seed = NULL)

Arguments

D
A vector specifying the type of distribution used in the model.
levID
A character (vector) specifies the level ID(s).
datafile
A file name where the WinBUGS data file will be saved in .txt format.
initfile
A file name where the WinBUGS initial values will be saved in .txt format.
modelfile
A file name where the WinBUGS model will be saved in .txt format.
bugEst
A file name where the estimates from BUGS will be stored in .txt format.
fact
A list of objects used to specify factor analysis. See Value below.
addmore
A vector of strings specifying additional coefficients to be monitored.
n.chains
The number of chains to be monitored. This should match up with the number of sets of initial values given.
n.iter
The number of iterations for each chain
n.burnin
The length of burn-in for each chain
n.thin
Thinning rate
debug
A logical value indicating whether (TRUE) or not (FALSE) to close the BUGS window after completion of the model run
bugs
The full name (including the path) of the BUGS executable
bugsWorkingDir
A directory where all the intermediate files are to be stored.
OpenBugs
If TRUE, OpenBUGS is used, if FALSE (the default) WinBUGS is used.
cleanBugsWorkingDir
If TRUE, the generated files will be removed from the bugsWorkingDir.
seed
A integer specifies a random seed.

Value

  • A list of objects to specify factor analysis, as used in the argument fact:
  • nfactSpecifies the number of factors
  • lev.factSpecifies the level/classification for the random part of the factor for each factor.
  • nfactorSpecifies the number of correlated factors
  • factorA vector specifying the correlated factors
  • ll{ (1) the first factor number; (2) the second factor number; (3) the starting value for the covariance and (4) an indicator of whether this covariance is constrained (1) or not (0). }
  • loadingA matrix specifying the starting values for the factor loadings and the starting value of the factor variance. Each row corresponds to a factor.
  • constrA matrix specifying indicators of whether the factor loadings and the factor variance are constrained (1) or not (0).

See Also

runMLwiN,rbugs