Learn R Programming

cg (version 1.0-3)

descriptiveTable.cgPairedDifferenceData: Compute Descriptive Summary Statistics of Groups in a cgPairedDifferenceData object

Description

Create a table of quantiles and other summary statistics of the data in a cgPairedDifferenceData object.

Usage

"descriptiveTable"(data, display = "print", ...)

Arguments

data
A cgPairedDifferenceData object, typically created by prepareCGPairedDifferenceData.
display
One of three valid values:
"print"
The default value; It calls a print method for the created descriptiveTable object, which is a formatted text output of the table.

"none"
Supresses any printing. Useful, for example, when just assignment of the resulting object is desired.

"show"
Calls the default showDefault method, which will just print out the cgPairedDifferenceData object components.

...
Additional arguments. Currently only one is valid:
logscale
A logical value, indicating whether or not the geometric means, their standard errors, and ratio differences should be included in the summary. If logscale is not specified, its value is taken from the cgPairedDifferenceData object, which prepareCGPairedDifferenceData sets from its logscale argument.

Value

Creates an object of class cgPairedDifferenceDescriptiveTable, with the following slots:
contents
The table of descriptive summary statistics for each group, and also for paired differences. See below for the data frame structure of the table.
settings
A list of settings carried from the cgPairedDifferenceData data object. These are used for the print.cgPairedDifferenceDescriptiveTable method, invoked for example when display="print".
The data frame structure of the descriptive table in a contents slot consists of row.names that specify the group or paired difference, and these columns:
n
The sample size.
Min
The minimum value.
25%ile
The 25th percentile, estimated with the quantile function.
Median
The median value.
75%ile
The 75th percentile, estimated with the quantile function.
Max
The maximum value.
Mean
The arithmetic mean value.
StdDev
The standard deviation value.
StdErr
The standard error value.
If logscale=TRUE, then two additional columns are added:
GeoMean
The geometric mean value of the group.
SEGeoMean
The estimated standard error associated with the geometric mean. This is calculated with the Delta Method, and will particularly lose accuracy in its useful approximation once the standard error in the log scale exceeds 0.50. A warning message is issued when this occurs.
The third row of simple difference summaries has GeoMean and SEGeoMean are set to .Fourth and fifth rows are also added with summaries of the paired ratio differences and percent differences. The StdDev and StdErr values are set to in these two rows. The GeoMean and SEGeoMean values are calculated via the the Delta Method, with the same caveats described above.

Details

The returned table contains quantiles, means, sample sizes, and estimates of variability for each group, and also for the paired differences. It also presents the same summary measures for the paired differences from the groups. If the logscale option is specified (either explicitly, or implicitly from the cgPairedDifferenceData object), then the geometric mean and geometric standard error for each of the two groups are included. Also included are summary measures of the ratio and percent forms of the paired differences. See the Value section below for details.

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)

descriptiveTable(anorexiaFT.data)

## Remove the geometric mean and standard error columns,
## and the Ratio / Percent Rows, since they are no longer applicable.

descriptiveTable(anorexiaFT.data, logscale=FALSE)


Run the code above in your browser using DataLab