diffGraph.pairedDifferenceData {cg}R Documentation

Graph Paired Differences from a cgPairedDifferenceData object

Description

Create a graph of profile pairs in a cgOnePairedDifferenceData object.

Usage

## S4 method for signature 'cgPairedDifferenceData'
diffGraph(data, ...)

Arguments

data

A cgPairedDifferenceData object.

...

Additional arguments, both optional. Two are currently valid:

logscale

A logical value, indicating whether or not the inidividual differences along the y-axis in the difference graph should be plotted on the logarithmic scale. If logscale is not specified, its value is taken from the cgPairedDifferenceData object, which prepareCGPairedDifferenceData sets from its logscale argument.

ticklabels

A list of two components:

mod

Can be either of these two values,

"replace"

Before graphing the data, remove any automatically generated tickmarks for the y-axis, and create the tickmarks specified in the marks component below.

"add"

Before graphing the data, add tickmarks specified in the marks component below, to the automatically generated ones.

marks

A vector of tickmarks to be placed on the y-axis. Any numeric representations will be coerced to character.

Details

The individual paired differences are displayed in 3 ways side by side.

Each difference is determined by subtracting the refgrp value from the other group's value, for each experimental unit in the data object of class cgPairedDifferenceData.

In the middle section, the individual paired difference points are jittered, and open circles are used to alleviate potential overlap and the danger of representing multiple points as a single point.

In the right hand section, a boxplot is added, similar to to that produced by graphics::boxplot.default, but with the median shown as a "+" and the mean shown as a "o". A warning on the lack of usefulness of a boxplot is added to the graph if there are have 5 or fewer paired differences.

Tick marks are attempted to be chosen wisely. For log-scaled axes in particular, leading digits of 2, 5, and 10 for values are included if possible. Since the algorithm is empirical, the ticklabels argument is available for further refinement or complete replacement of tickmarks.

The heading for the graph includes a creation of a character string: The "other" group versus the refgrp, e.g. B vs. A. Also included in the heading is the analysisname setting from the cgPairedDifferenceData object.

The label for the y-axis also includes the B vs. A character description of the comparison. If logscale=TRUE, precent differences represent the tickmarks on the log-spaced scale, since the differences in the log scale correspond to ratios in the original scale, e.g. B / A. Also included in the y-axis label is a character string derived from the endptname and endptunits settings in the cgPairedDifferenceData object. Percent differences make up the left-hand y-axis, and the corresponding Ratios make the right-hand left axis.

Minimum and maximum values from the range of the differences are respectively labeled in the bottom and top left corners of the graph region. Percentages are displayed when logscale=TRUE.

Value

diffGraph.cgPairedDifferenceData returns an invisible NULL. The main purpose is the side effect of graphing to the current device.

Note

Contact cg@billpikounis.net for bug reports, questions, concerns, and comments.

Author(s)

Bill Pikounis [aut, cre, cph], John Oleynick [aut], Eva Ye [ctb]

See Also

diffGraph.cgPairedDifferenceData

Examples

data(anorexia.FT)
anorexiaFT.data <- prepareCGPairedDifferenceData(anorexiaFT, format="groupcolumns",
                                                 analysisname="Anorexia FT",
                                                 endptname="Weight",
                                                 endptunits="lbs",
                                                 expunitname="Patient",
                                                 digits=1, logscale=TRUE)
diffGraph(anorexiaFT.data) 

## Graph the data on the original scale instead of the log scale.
diffGraph(anorexiaFT.data, logscale=FALSE)

[Package cg version 1.0-3 Index]