caterpillarR: Draws caterpillar plots of the residuals from a...

View source: R/caterpillarR.R

caterpillarRR Documentation

Draws caterpillar plots of the residuals from a mlwinfitIGLS-class or mlwinfitMCMC-class object, at a chosen level of the multilevel model.

Description

Uses qqmath in the lattice package to draw Quantile-Quantile plots of the residuals at a chosen level of a multilevel model against a theoretical distribution.

Usage

caterpillarR(resi, lev = 2)

Arguments

resi

A mlwinfitIGLS-class or mlwinfitMCMC-class object (model must be fitted specifying resi.store = TRUE and including 'variances' or 'sampling' in the list of resioptions (both in estoptions) to not return an error).

lev

An integer scalar specifying the level of a multilevel model for which to produce a plot for.

Value

See qqmath.

Author(s)

Zhang, Z., Charlton, C.M.J., Parker, R.M.A., Leckie, G., and Browne, W.J. (2016) Centre for Multilevel Modelling, University of Bristol.

See Also

caterpillar, qqmath

Examples


## 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)
# Caterpillar plot
caterpillarR(mymodel['residual'], lev = 2)

## End(Not run)


R2MLwiN documentation built on May 29, 2024, 2:10 a.m.