RCplot: Residuals vs Context plot

Description Usage Arguments Value Author(s) References See Also Examples

Description

Plots the residuals of a fitted VLMC model against the contexts, i.e., produces a boxplot of residuals for all contexts used in the model fit.

This has proven to be useful function, and the many optional arguments allow quite a bit of customization. However, the current implementation is somewhat experimental and the defaults have been chosen from only a few examples.

Usage

1
2
3
4
5
6
7
8
9
RCplot(x, r2 = residuals(x, "deviance")^2,
       alphabet = x$alpha, lab.horiz = k <= 20,
       do.call = TRUE,
       cex.axis = if (k <= 20) 1 else if (k <= 40) 0.8 else 0.6,
       y.fact = if (.Device == "postscript") 1.2 else 0.75,
       col = "gray70", xlab = "Context", main = NULL,
       med.pars = list(col = "red", pch = 12, cex = 1.25 * cex.axis),
       ylim = range(0, r2, finite = TRUE),
       ...)

Arguments

x

an R object of class vlmc.

r2

numeric vector, by default of squared deviance residuals of x, but conceptually any (typically non-negative) vector of the appropriate length.

alphabet

the alphabet to use for labeling the contexts, via id2ctxt.

lab.horiz

logical indicating if the context labels should be written horizontally or vertically.

do.call

logical indicating if the vlmc call should be put as subtitle.

cex.axis

the character expansion for axis labeling, see also par. The default is only approximately good.

y.fact

numeric factor for expanding the space to use for the context labels (when lab.horiz is false).

col

color used for filling the boxes.

xlab

x axis label (with default).

main

main title to be used, NULL entailing a sensible default.

med.pars

graphical parameters to be used for coding of medians that are almost 0.

ylim

y range limits for plotting.

...

further arguments to be passed to plot().

Value

Invisibly, a list with components

k

the number of contexts (and hence box plots) used.

fID

a factor (as used in the interncal call to plot.factor).

rp

a list as resulting from the above call to plot.factor().

Author(s)

Martin Maechler

References

Mächler M. and Bühlmann P. (2004) Variable Length Markov Chains: Methodology, Computing, and Software. J. Computational and Graphical Statistics 2, 435–455.

See Also

summary.vlmc for other properties of a VLMC model.

Examples

1
2
3
example(vlmc)
RCplot(vlmc.pres)
RCplot(vlmc.dt1c01)## << almost perfect fit (0 resid.)

VLMC documentation built on May 1, 2019, 11:32 p.m.

Related to RCplot in VLMC...