Draws predicted lines using a fitted model object

Share:

Description

This function draws predicted lines against an explanatory variable for selected groups at a higher (>=2) level. Note that it uses a lot of contiguous memory, and so we recommend running via 64-bit version R to mititage against any potential problems.

Usage

1
2
3
predLines(object, indata = NULL, xname, lev = 2, selected = NULL,
  probs = c(0.025, 0.975), legend = TRUE, legend.space = "top",
  legend.ncol = 4, ...)

Arguments

object

Either an mlwinfitIGLS-class or mlwinfitMCMC-class object.

indata

A data.frame object containing the data. If not specified, data is extracted from the object.

xname

The name of the variable to be plotted.

lev

A digit indicating the level (of the multilevel model) at which to plot.

selected

A vector specifying groups to selectively plot at the level specified in lev. If selected = NULL, then all groups at that level are included.

probs

A numeric vector of probabilities with values in [0, 1] used to calculate the lower and upper quantiles from which the error bars are plotted. Currently, this is only available for an mlwinfitMCMC-class object.

legend

A logical value indicating whether a legend is to be added.

legend.space

A character string specifies one of the four sides, which can be one of 'top', 'bottom', 'left' and 'right'. Default, legend.space = 'top'.

legend.ncol

An integer specifies a number of columns, possibly divided into blocks, each containing some rows. Default, legend.ncol = 2.

...

Other arguments to be pased to xyplot.

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

predCurves

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
## Not run: 
library(R2MLwiN)
# NOTE: if MLwiN not saved in location R2MLwiN defaults to, specify path via:
# options(MLwiN_path = 'path/to/MLwiN vX.XX/')
# If using R2MLwiN via WINE, the path may look like this:
# options(MLwiN_path = '/home/USERNAME/.wine/drive_c/Program Files (x86)/MLwiN vX.XX/')

## Example: tutorial
data(tutorial, package = "R2MLwiN")
(mymodel <- runMLwiN(normexam ~ 1 + standlrt + (1 + standlrt | school) + (1 | student),
                     estoptions = list(EstM = 1, resi.store.levs = 2), data = tutorial))

predLines(mymodel, xname = "standlrt", lev = 2, selected = c(30, 44, 53, 59),
          probs = c(0.025, 0.975))

## End(Not run)

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.