Learn R Programming

cg (version 1.0-3)

kmGraph: Graph Distribution Functions of Groups

Description

Create non-parametric survival or cumulative distribution graphs based on a data object in the cg package.

Usage

kmGraph(data, cgtheme = TRUE, distfcn = "survival", ylab = NULL, title = NULL, ...)

Arguments

data
A data object created using the cg package. The only class of object currently available is cgOneFactorData, which is created by the prepareCGOneFactorData function.
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".
distfcn
A character, which may be either "survival" to graph the survival function, or "cumulative" to graph the cumulative distribution function.
ylab
Specify a character value for the y-axis label. The default value is NULL.
title
Specify a character value for the main title at the top of the graph. The default value is NULL.
...
Additional arguments, depending on the specific method written for the object. Currently, there is only one such specific method; see kmGraph.cgOneFactorData for any additional arguments that can be specified.

Value

The main purpose is the side effect of graphing to the current device. See the specific methods for discussion of any return values.

Details

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.

See Also

kmGraph.cgOneFactorData

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")
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)

Run the code above in your browser using DataLab