Learn R Programming

cg (version 1.0-3)

samplesizeGraph.cgPairedDifferenceSampleSizeTable: Graph estimated sample sizes from a cgPairedDifferenceSampleSizeTable object

Description

Creates a graph to see estimated sample sizes in a cgPairedDifferenceSampleSizeTable object.

Usage

"samplesizeGraph"(sstable, Nscale, mmdscale, ...)

Arguments

sstable
A sample size object of class cgPairedDifferenceSampleSizeTable.
Nscale
A character indicating whether the left-hand side Y-axis, which shows the estimated sample sizes in terms of the number of experimental units, should be drawn on the log scale ("log") or the original scale ("original").
mmdscale
A character indicating whether the X-axis, which shows the minimum meaningful differences to be detected, should be drawn on the log scale ("log") or the original scale ("original").
...
Additional arguments. Two are currently valid:

nscale
A character indicating whether the Y-axis, which shows the estimated sample sizes in terms of the number of n experimental units on the left-hand axis, should be drawn on the log scale ("log") or the original scale ("original"). This will override the Nscale argument, which serves the same purpose.

mmdticklabels
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 x-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 x-axis. Any numeric representations will be coerced to character.

nticklabels
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 numeric vector of tickmarks to be placed on the y-axis. Any numeric representations will be coerced to character.

Value

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

Details

The minimum and maximum experimental unit sample size values are added inside the plot region in blue, flush against the y-axis in the top and bottom left corners. 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 method essentially portrays in a graph the same information shown by the print method of the cgPairedDifferenceSampleSizeTable object.

See Also

cgPairedDifferenceSampleSizeTable

Examples

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

## The interest is in increased weight for the anorexia FT
## (family treatment) group of patients
anorexiaFT.samplesize <- samplesizeTable(anorexiaFT.fit, direction="increasing",
                         mmdvec=c(5, 10, 15, 20)) ## print method shows table

samplesizeGraph(anorexiaFT.samplesize)

samplesizeGraph(anorexiaFT.samplesize, nticklabels=list(mod="add", marks=3))

Run the code above in your browser using DataLab