kmGraph.cgOneFactorData {cg}R Documentation

Graph Distribution Functions of Groups in a cgOneFactorData object

Description

Create a non-parametric survival or cumulative distribution graph of groups of data in a cgOneFactorData object.

Usage

## S4 method for signature 'cgOneFactorData'
kmGraph(data, cgtheme = TRUE, distfcn ="survival",
 ylab = NULL, title = NULL, ...)

Arguments

data

A cgOneFactorData object.

cgtheme

A logical value, indicating whether to use the cg limited color scheme (white backgrounds, including shingles) or the current Trellis color scheme. The default is TRUE.

distfcn

A character value, which may be either the default "survival" to graph the survival function, or "cumulative" to graph the cumulative distribution function.

ylab

Optional, a character value to label the y-axis of the graph. If NULL, it defaults to either "Probability of Survival"
or "Cumulative Probability", depending on the value of distfcn.

title

Optional, a character to show as the title of the graph. If NULL, it defaults to either "Nonparametric Survival Curve Estimates"
or "Nonparametric Cumulative Distribution Function Estimates", depending on the value of distfcn.

...

Additional arguments. One is currently valid:

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 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.

Details

Graph the estimated survival function or cumulative distribution for each group in a cgOneFactorData object. For censored data, Kaplan-Meier estimates are used. For uncensored data, the conventional step function empirical estimates are used.

Color assignments of the graphed step functions lines for the groups match the order of the group name factor levels. The color order is given in cgLineColors. The line widths are set to be thicker (lwd=2), and the group name label is placed near the line using label methodology from the Hmisc package.

The x-axis represents response values, and y-axis represents estimated probabilities. Minimum and maximum values from ranges of data are respectively labeled in the bottom left and right corners of graph regions.

The label for the x-axis is taken from the cgOneFactorData object, which prepareCGOneFactorData sets from its endptname and endptunits arguments.

The number of decimal places printed in the ticks on the x-axis is taken from the cgOneFactorData object, which prepareCGOneFactorData sets from its digits argument.

Value

kmGraph.cgOneFactorFit 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]

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")
kmGraph(canine.data, distfcn="cumulative")
kmGraph(canine.data, distfcn="cumulative",
        ticklabels=list(mod="add", marks=c(2)))

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

[Package cg version 1.0-3 Index]