Learn R Programming

cg (version 1.0-3)

comparisonsTable: Create a Table of Comparisons amongst Groups

Description

Create a table of comparisons based on a fit by the cg package.

Usage

comparisonsTable(fit, type = "pairwisereflect", alpha = 0.05, addpct = FALSE, display = "print", ...)

Arguments

fit
A fit object created with a fit method from the cg package. See specific methods.
type
Can be one of four values:

"pairwisereflect"
The default value; It calculates and lists all possible pairwise comparison permutations, as each pair order is included. In other words, Groups A vs. B and B vs. A will be included.

"pairwise"
Calculates and lists all possible pairwise comparison combinations. Once a pair such as Groups A vs. B is specified, then the reflective B vs. A is not included. So the number of comparisons is half that produced by "pairwisereflect". The ordering of group levels in the fit object is used to determine which ordering is included and which is not. If all orderings are of interest, such as for settings$endptscale=="log" in the fit object, use the "pairwisereflect" value above.

"allgroupstocontrol"
Takes the value of settings$refgrp in the cg fit object, deems it the "control" group, and constructs pairwise comparisons of all other groups to it.

"custom"
Indicates that a custom matrix of comparisons will be constructed, and that matrix needs to be specified in the contrastmatrix argument of a method.

alpha
Significance level, by default set to 0.05.
addpct
Only relevant if settings$endptscale=="original" in the fit object. An column of percent differences is added for the comparisons, as a descriptive supplement to the original scale differences that are formally estimated.
display
One of three valid values:
"print"
The default value, it calls a print method for the created ComparisonsTable object, which is a formatted text output of the table(s).

"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 ComparisonsTable object components.

...
Additional arguments, depending on the specific method written for the object. See the method-specific documentation for additional details.

Value

A method-specific comparisonsTable object is returned. See the specific methods for discussion of return values.

See Also

comparisonsTable.cgOneFactorFit, comparisonsTable.cgPairedDifferenceFit.

Examples

Run this code
#### One Factor data

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.comps0 <- comparisonsTable(canine.fit)

canine.comps1 <- comparisonsTable(canine.fit,  mcadjust=TRUE,
                                   type="allgroupstocontrol", refgrp="CC")


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

gmcsfcens.fit <- fit(gmcsfcens.data, type="aft")

gmcsfcens.comps <- comparisonsTable(gmcsfcens.fit)

## Paired Difference data

data(anorexiaFT)
anorexiaFT.data <- prepareCGPairedDifferenceData(anorexiaFT, format="groupcolumns",
                                                 analysisname="Anorexia FT",
                                                 endptname="Weight",
                                                 endptunits="lbs",
                                                 expunitname="Patient",
                                                 digits=1,
                                                 logscale=TRUE)
anorexiaFT.fit <- fit(anorexiaFT.data)

comparisonsTable(anorexiaFT.fit)

Run the code above in your browser using DataLab