Learn R Programming

cg (version 1.0-3)

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

Description

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

Usage

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

Arguments

sstable
A sample size object of class cgOneFactorSampleSizeTable.
Nscale
A character indicating whether the Y-axis, which shows the estimated samples sizes, 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:
cgtheme
When set to the default TRUE, ensures a trellis device is active with limited color scheme. Namely background, strip.shingle, and strip.background are each set to "white".

device
Can be one of three values:
"single"
The default, which will put all graphs on the same device page. For example, when resistant & robust and classical least squares sample size estimates are present and model="both" (the default), a 2 x 1 paneled graph will be created.

"multiple"
Relevant only when resistant & robust and classical least squares sample size estimates are present and model="both". In those cases, a new graphics device is generated to hold the resistant & robust version, as a single-paneled graph, and the classical least squares version is on the previous device.

"ask"
Relevant only when resistant & robust and classical least squares samples size estimates are present and model="both" (the default). In that case, each are portrayed as a single-paneled graph, with the ask=TRUE argument specified in par so that the user input confirmation is needed before the graphs are drawn.

model
For cgOneFactorOneSampleSizeTable objects that have classical least squares lm() filled or resistant & robust rlm() filled slots, the following argument values are possible:
"both"
Sample Size graphs based on both the ordinary classical least squares and resistant & robust slots are populated. This is the default when both slots are present in the cgOneFactorSampleSizeTable object specified in the sstable argument. If the resistant & robust fit is not available, this value is not relevant.

"olsonly"
Only an Sample Size Table Graph based on the ordinary classical least squares table slot is created.

"rronly"
Only a Sample Size Table Graph based on the resistant and robust table slot is created.

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

Value

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

Details

The minimum and maximum 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 cgOneFactorSampleSizeTable object.

See Also

cgOneFactorSampleSizeTable

Examples

Run this code
data(canine)
canine.data <- prepareCGOneFactorData(canine, format="groupcolumns",
                                      analysisname="Canine",
                                      endptname="Prostate Volume",
                                      endptunits=expression(plain(cm)^3),
                                      digits=1, logscale=TRUE, refgrp="CC")
canine.fit <- fit(canine.data)

canine.samplesize <- samplesizeTable(canine.fit, direction="increasing", 
                                     mmdvec=c(10, 25, 50, 75, 100)) ## print method shows table

samplesizeGraph(canine.samplesize)

samplesizeGraph(canine.samplesize, model="olsonly",
                mmdticklabels=list(mod="add", marks=100))

Run the code above in your browser using DataLab