descriptiveTable.cgOneFactorData {cg}R Documentation

Compute Descriptive Summary Statistics of Groups in a cgOneFactorData object

Description

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

Usage

## S4 method for signature 'cgOneFactorData'
descriptiveTable(data, display = "print", ...)

Arguments

data

A cgOneFactorData object, typically created by prepareCGOneFactorData.

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 cgOneFactorDescriptiveTable object components.

...

Additional arguments. Currently only one is valid:

logscale

A logical value, indicating whether or not the geometric means and standard errors should be included in the summary. If logscale is not specified, its value is taken from the cgOneFactorData object, which prepareCGOneFactorData sets from its logscale argument.

Details

The returned table contains quantiles, means, sample sizes, and estimates of variability for each group. If censored data are present, the estimated quantiles accomodate that with the Kaplan-Meier method, following Gentleman and Crowley (1991) . The number of censored / incomplete and number of complete observations are also included when censored data is present in any of the groups. If the logscale option is specified (either explicitly, or implicitly from the cgOneFactorData object), then the geometric mean and geometric standard error for each group are also included. See the Value section below for details.

Value

Creates an object of class cgOneFactorDescriptiveTable, with the following slots:

contents

The table of descriptive summary statistics for each group. See below for the data frame structure of the table.

settings

A list of settings carried from the cgOneFactorData data object. These are used for the print.cgOneFactorDescriptiveTable 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, and these columns:

n

The sample size of the group.

Min

The minimum value of the group.

25%ile

The 25th percentile of the group, estimated with the quantile function.

Median

The median value of the group.

75%ile

The 75th percentile of the group, estimated with the quantile function.

Max

The maximum value of the group.

Mean

The arithmetic mean value of the group.

StdDev

The standard deviation value of the group.

StdErr

The standard error value of the group.

If logscale=TRUE, then two additional columns are added:

GeoMean

The geometric mean value of the group.

SEGeoMean

The estimated standard error associated withthe 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.

If censored data are present in the cgOneFactorData object, then two more columns are added:

ncensored

The number of censored / incomplete observations.

ncomplete

The number of complete observations.

These two ncensored and ncomplete quantities will add up to n above and be placed adjacent to it.

The presence of censored observations will convert columns such as the Min and Max to character values, with the appropriate ">" and "<" symbols for right-censoring and left-censoring, respectively.

For censored data, Kaplan-Meier estimates are used for the quantiles, as proposed by Gentleman and Crowley (1991). The survreg::survfit conventions are followed for interpolation of these quantiles. With enough censored data observations in a group, certain quantiles may not be estimable. If any censored observations are present, the mean, geometric mean, and associated standard errors will not be calculated. The <NA> character representation is used.

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]

References

Gentleman, R.C. and Crowley, J. (1991). "Graphical Methods for Censored Data", Journal of the American Statistical Association, Volume 86, 678-683.

Examples

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

descriptiveTable(canine.data)

## Remove the geometric mean and standard error columns
descriptiveTable(canine.data, logscale=FALSE)

## Censored Data
data(gmcsfcens)
gmcsfcens.data <- prepareCGOneFactorData(gmcsfcens, format="groupcolumns",
                                         analysisname="cytokine",
                                         endptname="GM-CSF (pg/ml)",
                                         logscale=TRUE)
descriptiveTable(gmcsfcens.data)

[Package cg version 1.0-3 Index]