plot-methods: Plotting canonical parameter sets

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

Description

For LuckModel objects, the function plot gives a method to display prior or posterior sets of canonical parameters graphically. The strength parameter n^(0) resp. n^(n) is plotted on the abscissa (x) axis, the main parameter y^(0) resp. y^(n) on the ordinate (y) axis. Specific plotting options are given to plot via the argument control that is a list of arguments that can be produced with the help of the function controlList, which is also described here.

Usage

1
2
3
4
5
6
plot(x, y, control = controlList(), add = FALSE, ...)

controlList(plotdim = NA, posterior = FALSE, annotate = TRUE, rDigits = 2,
            numbers = FALSE, rectangle = FALSE, polygonCol = "gray",
            borderCol = 1, rectCol = 1, rectLty = 4, numCol = 1, density = NULL,
            angle = 45, plotSeqLength = 100)

Arguments

x

A LuckModel object.

y

y is not needed, and therefore of class missing. Any input will be ignored.

control

The list of controls to address options for appearance of the plot. This includes whether the prior or the posterior parameter set should be drawn. Default is the value of controlList(), a function that returns a list containing the required elements with their default value. The arguments for controlList is described below.

add

Whether the plot should be added to an existing plot or not. Default is FALSE, i.e., a new plot device is opened.

...

Graphic parameters such as xlim, ylim etc. can be given as arguments. For controlling colors, there are specialised arguments boderCol and polygonCol to controlList, see below.

plotdim

Which dimension of the main parameter y^(0) should be displayed in the ordinate (y axis). With the default value NA, the sets for all dimensions are plotted in the same frame. Specific dimensions are addressed by their row number in the y0 slot of the LuckModel object. If y^(0) is one-dimensional, i.e., y0 has only one row, then NA and 1 will have the same result, and any other values will give an error.

posterior

Whether the prior or the posterior parameter set should be drawn. For the default FALSE, the prior set is drawn. If posterior = TRUE, the posterior parameter set is drawn. In this case, it is necessary that the LuckModel object contains data in order to calculate the posterior parameter set; otherwise this results in an error.

annotate

Whether annotations for the parameter set in the plot margins should be displayed. For TRUE, the default, the axes are labeled, and information on the parameter sets is printed in the upper margin (via title(main=...)).

rDigits

The number of digits to be displayed in the margin annotations (see annotate) and in the set annotations (see numbers below). Default is 2.

numbers

Whether the extremes of y^(0) resp. y^(n) should be printed in the plot next to the four corners of the parameter set. Default is FALSE.

rectangle

Whether the rectangle containing the (non-rectangle) posterior parameter set should be drawn. This can serve to illustrate that considering y^(n) as an interval-valued parameter, without bearing in mind that the range of y^(n) changes with y^(n), amounts to a loss of information, and may result in incorrect posterior inferences (too wide bounds). This is the reason why posterior sets are not explicitely represented as LuckModel objects.

polygonCol

The colour to fill the parameter set with. Default is "gray", other colours can be chosen as usual (see par), by text strings or numbers. For multidimensional main parameters, also a vector of colours can be supplied.

borderCol

The colour of the lines delineating the paramer set. Default is 1 (black), other colours can be chosen as usual, by text strings or numbers. With NA, no borders are drawn. For multidimensional main parameters, also a vector of colours can be supplied.

rectCol

The colour of the lines delineating the rectangle circumscribing the parameter set (see rectangle). Default is 1 (black), other colours can be chosen as usual, by text strings or numbers. For multidimensional main parameters, also a vector of colours can be supplied.

rectLty

The type of the lines delineating the rectangle circumscribing the paramer set (see rectangle). Default is 4 (dashed), other line types can be chosen as usual (see par, entry lty). For multidimensional main parameters, also a vector of line types can be supplied.

numCol

The colour to print the annotation numbers in the plot (see numbers). Default is 1 (black), other colours can be chosen as usual, by text strings or numbers. For multidimensional main parameters, also a vector of colours can be supplied.

density

As an alternative to filling the parameter set (see polygonCol), shading lines can be drawn instead. density controls the density of shading lines, in lines per inch. (See polygon.) Default is NULL, which means no shading. For multidimensional main parameters, also a vector of shade densities can be supplied.

angle

The slope of the shading lines, given as an angle in degrees, counter-cockwise. If density is not specified, this is ignored. Default is 45. For multidimensional main parameters, also a vector of angles can be supplied.

plotSeqLength

The number of points for plotting the posterior parameter set contours. The higher the number, the more accurate the display of the set contours. The default value of 100 should be enough for normal-sized graphs.

Details

The argument control can be created via the function controlList, its usage and arguments which control the appearance of the plot are described above. It may be called with only one or a few named arguments, such that the default values are assigned to the rest.

If the LuckModel object specifies both y^(0) and n^(0) interval-valued, then the prior parameter set is a simple rectangle. If both y^(0) and n^(0) are single numbers, the prior parameter set is drawn as a dot of the default line width. The line width can be modified via the argument lwd to plot() (see par). If n^(0) is interval-valued, posterior parameter sets have usually less trivial shapes.

For multidimensional main parameters, plotdim=NA (the default) will plot y against n for each dimension of y in the same plot, such that the lower-dimension sets may be overplotted. The plotting region, if not defined via ylim, is determined by the first dimension. Usually, it might be more useful to draw a separate plot for each dimension, using plotdim=1, plotdim=2, etc.

Value

The function is used for its side effects (the plot).

Author(s)

Gero Walter

References

Gero Walter and Thomas Augustin (2009), Imprecision and Prior-data Conflict in Generalized Bayesian Inference, Journal of Statistical Theory and Practice 3:255-271.

See Also

luck for a general description of the package, LuckModel for the class this plot method is for, and LuckModelData for the class for its data slot. par for how to specify colors, line types and other graphical parameters.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
luck1 <- LuckModel(n0=c(2,10), y0=c(3, 4), data=LuckModelData(tau=sum(rnorm(5)), n=5))
# prior parameter set
plot(luck1)
# posterior parameter set with annotations
plot(luck1, control = controlList(posterior = TRUE, annotate = TRUE))
# low-resolution posterior parameter set with numbers
plot(luck1, control = controlList(posterior = TRUE, plotSeqLength = 10, numbers = TRUE))
luck2 <- LuckModel(n0 = c(1,10), y0 = c(-5, 10, 5, 15))
# two-dimensional main parameter, in one plot, using shading lines instead of colour filling
plot(luck2, ylim=c(-6,16), control=controlList(borderCol=c(1,2), #
     polygonCol=c("blue", "grey"), density=c(10,NA), angle=c(25,95)))
# posterior parameter set with rectangle and numbers, other graphical parameters
plot(luck1, control = controlList(posterior = TRUE, rectangle = TRUE, rectCol = 2, #
                                  rectLty = "2244", numbers = TRUE, numCol = 4), #
     xlim = c(0,15), ylim = c(0,10), cex.main = 0.8, cex = 0.5)
# adding the prior parameter set
plot(luck1, add = TRUE)

luck documentation built on May 2, 2019, 4:43 p.m.