| comparisonsTable.cgPairedDifferenceFit {cg} | R Documentation |
Create a table of comparisons between two groups with the cgPairedDifferenceFit object
Description
Create a table of comparisons based on the cgPairedDifferenceFit object. A cgPairedDifferenceComparisonsTable class object is created.
Usage
## S4 method for signature 'cgPairedDifferenceFit'
comparisonsTable(fit, type="pairwisereflect",
alpha=0.05, addpct=FALSE, display="print", ...)
Arguments
fit |
An object of class |
type |
Can be one of two values:
|
alpha |
Significance level, by default set to |
addpct |
Only relevant if |
display |
One of three valid values:
|
... |
Additional arguments. Only one is currently valid:
|
Value
Creates an object of class cgPairedDifferenceComparisonsTable, with the
following slots:
ols.comprsThe table of comparisons based on the
olsfitcomponent of thecgPairedDifferenceFit, unlessmodel="rronly"is specified. In that case the slot value isNULL. See below for the data frame structure of the table.rr.comprsThe table of comparisons based on the
rrfitcomponent of thecgPairedDifferenceFitobject, if a valid resistant & robust fit object is present. Ifrrfitis a simple character value of"No fit was selected.", ormodel="olsonly"was specified, then the value isNULL. See below for the data frame structure of the table.settingsA list of settings carried from the
cgPairedDifferenceFitfitobject, and the addition of some specified arguments in the method call above:alpha,type, andaddpct. These are used for theprint.cgPairedDifferenceComparisonsTablemethod, invoked for example whendisplay="print".
The data frame structure of the comparisons table in a *.comprs
slot consists of row.names that specify the comparison of the
form A vs. B, and these columns:
estimateThe difference in group means in the comparison: A vs. B. If
settings$endptscale=="log"in thefitobject, this will be back-transformed to a percent difference scale.seThe estimated standard error of the difference
estimate. Ifsettings$endptscale=="log"in thefitobject, this estimate will be based on the Delta method, and will particularly begin to be a poor approximation when the standard error in the logscale exceeds 0.50.lowerciThe lower 100 * (1-
alpha) % confidence limit of the differenceestimate. With the defaultalpha=0.05, this is 95%. Ifsettings$endptscale=="log"in thefitobject, the confidence limit is first computed in the logarithmic scale of analysis, and then back-transformed to a percent difference scale.upperciThe upper 100 * (1-
alpha) % confidence limit of the differenceestimate. With the defaultalpha=0.05, this is 95%. Ifsettings$endptscale=="log"in thefitobject, the confidence limit is first computed in the logarithmic scale of analysis, and then back-transformed to a percent difference scale.pvalThe computed p-value from the test of the difference
estimate.meanAorgeomeanAThe estimated mean for the left hand side "A" of the A vs. B comparison. If
settings$endptscale=="log"in thefitobject, this is a back-transform to the original scale, and therefore is a geometric mean, and will be labelledgeomeanA. Otherwise it is the arithmetic mean and labelledmeanA.seAThe estimated standard error of the
meanAestimate. Ifsettings$endptscale=="log"in thefitobject, this estimate will be based on the Delta method, and will particularly begin to be a poor approximation when the standard error in the logscale exceeds 0.50.meanBorgeomeanBThe estimated mean for the right hand side "B" of the A vs. B comparison. If
settings$endptscale=="log"in thefitobject, this is a back-transform to the original scale, and therefore is a geometric mean, and will be labelledgeomeanB. Otherwise it is the arithmetic mean and labelledmeanB.seBThe estimated standard error of the
meanBestimate. Ifsettings$endptscale=="log"in thefitobject, this estimate will be based on the Delta method, and will particularly begin to be a poor approximation when the standard error in the logscale exceeds 0.50.
An additional column addpct of percent differences is added if
endptscale=="original" and addpct=TRUE,
as a descriptive supplement to the original scale
differences that are formally estimated. This is only possible for
the model=="ols" case, since the original arithmetic means
are not estimated in the Resistant & Robust model=="rr" case.
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(anorexiaFT)
## log scale
anorexiaFT.data <- prepareCGPairedDifferenceData(anorexiaFT, format="groupcolumns",
analysisname="Anorexia FT",
endptname="Weight",
endptunits="lbs",
expunitname="Patient",
digits=1,
logscale=TRUE)
anorexiaFT.fit <- fit(anorexiaFT.data)
anorexiaFT.comps <- comparisonsTable(anorexiaFT.fit, display="none")
print(anorexiaFT.comps)
comparisonsTable(anorexiaFT.fit, model="olsonly")
comparisonsTable(anorexiaFT.fit, model="rronly")
## original scale evaluation
anorexiaFT.orig.data <- prepareCGPairedDifferenceData(anorexiaFT, format="groupcolumns",
analysisname="Anorexia FT",
endptname="Weight",
endptunits="lbs",
expunitname="Patient",
digits=1,
logscale=FALSE)
anorexiaFT.orig.fit <- fit(anorexiaFT.orig.data)
comparisonsTable(anorexiaFT.orig.fit)
comparisonsTable(anorexiaFT.orig.fit, addpct=TRUE)