agreementplot {vcd} | R Documentation

## Bangdiwala's Observer Agreement Chart

### Description

Representation of a k by k confusion matrix, where the observed and expected diagonal elements are represented by superposed black and white rectangles, respectively. The function also computes a statistic measuring the strength of agreement (relation of respective area sums).

### Usage

    ## Default S3 method:
    agreementplot(x, reverse_y = TRUE, main = NULL,
                  weights = c(1, 1 - 1/(ncol(x) - 1)^2), margins = par("mar"),
                  newpage = TRUE, pop = TRUE, xlab = names(dimnames(x))[2],
                  ylab = names(dimnames(x))[1],
                  xlab_rot = 0, xlab_just = "center",
                  ylab_rot = 90, ylab_just = "center", ...)
    ## S3 method for class 'formula':
    agreementplot(formula, data = NULL, ..., subset)

### Arguments

`x` | a confusion matrix, i.e., a table with equal-sized dimensions.
`reverse_y` | if `TRUE`, the y axis is reversed (i.e., the rectangles' positions correspond to the contingency table).
`main` | user-specified main title.
`weights` | vector of weights for successive larger observed areas, used in the agreement strength statistic, and also for the shading. The first element should be 1.
`margins` | vector of margins (see `par`).
`newpage` | logical; if `TRUE`, the plot is drawn on a new page.
`pop` | logical; if `TRUE`, all newly generated viewports are popped after plotting.
`xlab, ylab` | labels of x- and y-axis.
`xlab_rot, ylab_rot` | rotation angle for the category labels.
`xlab_just, ylab_just` | justification for the category labels.
`formula` | a formula, such as `y ~ x`. For details, see `xtabs`.
`data` | a data frame (or list), or a contingency table from which the variables in `formula` should be taken.
`subset` | an optional vector specifying a subset of the rows in the data frame to be used for plotting.
`...` | further graphics parameters (see `par`).

### Details

Weights can be specified to allow for partial agreement, taking into account contributions from off-diagonal cells. A weight vector of length 1 means strict agreement only, each additional element increases the maximum number of disagreement steps.

### Value

Invisibly returned, a list with components

`Bangdiwala` | the unweighted agreement strength statistic.
`Bangdiwala_Weighted` | the weighted statistic.
`weights` | the weigtht vector used.

### Author(s)

David Meyer David.Meyer@R-project.org

### References

Michael Friendly (2000), Visualizing Categorical Data. SAS Institute, Cary, NC.

### Examples

    data(SexualFun)
    agreementplot(t(SexualFun))

    data(MSPatients)
    get(getOption("device"))(width = 12)
    pushViewport(viewport(layout = grid.layout(ncol = 2)))
    pushViewport(viewport(layout.pos.col = 1))
    agreementplot(t(MSPatients[,,1]), main = "Winnipeg Patients",
                  newpage = FALSE)
    popViewport()
    pushViewport(viewport(layout.pos.col = 2))
    agreementplot(t(MSPatients[,,2]), main = "New Orleans Patients",
                  newpage = FALSE)
    popViewport(2)
    dev.off()

[Package vcd version 0.9-6 Index]