A convenient wrapper for the plot
function with the addition
of error bars, e.g. to create caterpillar plots.
1 2  caterpillar(y, x, qtlow, qtup, xlab = "", ylab = "", xlim = NULL,
ylim = NULL, main = "")

y 
A numerical vector specifying the 
x 
A numerical vector specifying the 
qtlow 
A numerical vector (e.g. of lowerquantiles) to be used to plot lower error bars. 
qtup 
A numerical vector (e.g. of upperquantiles) to be used to upper plot error bars. 
xlab 
A label for the 
ylab 
A label for the 
xlim 
The 
ylim 
The y limits of the plot; see 
main 
A main title for the plot; see 
Zhang, Z., Charlton, C.M.J., Parker, R.M.A., Leckie, G., and Browne, W.J. (2016) Centre for Multilevel Modelling, University of Bristol, U.K.
caterpillarR
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23  ## Not run:
library(R2MLwiN)
# NOTE: if MLwiN not saved where R2MLwiN defaults to:
# options(MLwiN_path = 'path/to/MLwiN vX.XX/')
# If using R2MLwiN via WINE, the path may look like:
# options(MLwiN_path = '/home/USERNAME/.wine/drive_c/Program Files (x86)/MLwiN vX.XX/')
# Example using tutorial dataset
data(tutorial, package = 'R2MLwiN')
(mymodel < runMLwiN(normexam ~ 1 + (1  school) + (1  student),
estoptions = list(resi.store = TRUE),
data = tutorial))
# For each school, calculate the CIs...
residuals < mymodel@residual$lev_2_resi_est_Intercept
residualsCI < 1.96 * sqrt(mymodel@residual$lev_2_resi_var_Intercept)
residualsRank < rank(residuals)
rankno < order(residualsRank)
caterpillar(y = residuals[rankno], x = 1:65, qtlow = (residuals  residualsCI)[rankno],
qtup = (residuals + residualsCI)[rankno], xlab = 'Rank', ylab = 'Intercept')
## End(Not run)

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.
All documentation is copyright its authors; we didn't write any of that.