comparisons(estimates, varcovmatrix, errordf = Inf, endptscale, mcadjust = FALSE, alpha = 0.05, type = "pairwisereflect", contrastmatrix = NULL, n, offset = NULL, cnames = "derive", analysisname = "", endptname = "", digits = NULL, addpct = FALSE, display = "print")
estimates
. Must have the same number of columns and rows as the length
of the estimates
vector.
Inf
numeric
"approx"
variance-covariance
matrix and
n
to
estimate the degrees of freedom for each comparison. The
variance-covariance matrix will need to be diagonal. Only will be
accepted when mcadjust=FALSE
.
"log"
or
"original"
. If "log"
then the estimates
vector
is assumed to be in the log scale, and calculations will
transform it to the original scale for the generated table.
FALSE
.
If mcadjust=TRUE
is specified, there will be a delay,
usually just for a few seconds, due to computing time of the
critical point in order to conduct the adjusted comparisons.
0.05
to
correspond to 95% confidence.
"pairwisereflect"
"pairwise"
"pairwisereflect"
. The ordering of group levels in the
estimates
vector is used to determine which
ordering is included and which is not. If all orderings are
of interest, such as for endptscale=="log"
,
use the "pairwisereflect"
value above.
"allgroupstocontrol"
estimate
vector,
deems it the "control" group, and constructs
pairwise comparisons of all other groups to it.
"custom"
contrastmatrix
argument.
type="custom"
is
specified. In that case, a numeric matrix with the number of
rows equal to the number of comparisons of interest is needed. The number
of columns must be equal to the number of groups in the
estimate
vector. Each row in
the matrix is assumed to represent a contrast of coefficients
amongst the groups that defines the comparison of interest.
errordf="approx"
. In this case it needs to be a vector of
group sample sizes, the same in length as the estimates
vector.
estimates
as means in the
"log"
scale, this could be used to
adjust the estimates and comparisons appropriately. The default
is NULL
.
"derive"
is used, row names are
derived for the table that reflect the A vs. B type of
comparison items in each row, using the names attrributes of the
estimates
vector and the middle term of "vs."
Otherwise,
this can be explicitly specified and needs to be a character vector of
the same length as estimates
.
""
.""
.NULL
, which will examine each individual estimates
value and choose the
one that has the maximum number of digits after any trailing
zeroes are ignored. The max number of digits will be 4.endptscale=="original"
.
An column of percent differences is added for the
comparisons, as a descriptive supplement to the original scale
differences that are formally estimated.
"print"
print
method for the
created object, which is
a formatted text output of the table(s).
"none"
"show"
showDefault
method, which
will just print out the comparisons
return object.
estimate
endptscale="log"
,
this will be back-transformed to a percent
difference scale.
se
estimate
. If endptscale="log"
,
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.
lowerci
alpha
) % confidence limit of the
difference estimate
. With the default alpha=0.05
,
this is 95%. If endptscale="log"
,
the confidence limit is first computed in the
logarithmic scale of analysis, and then back-transformed to a percent
difference scale.
upperci
alpha
) % confidence limit of the
difference estimate
. With the default alpha=0.05
,
this is 95%. If endptscale="log"
,
the confidence limit is first computed in the
logarithmic scale of analysis, and then back-transformed to a percent
difference scale.
pval
estimate
.
meanA
or geomeanA
endptscale="log"
,
this is a back-transform to the original scale,
and therefore is a "geometric" mean, and will be labelled
geomeanA
. Otherwise it is the arithmetic mean and labelled meanA
.
seA
meanA
estimate
. If endptscale="log"
, 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.
meanB
or geomeanB
endptscale="log"
, this is a back-transform to the original scale,
and therefore is a "geometric" mean, and will be labelled
geomeanB
.
Otherwise it is the arithmetic mean and labelled meanB
.
seB
meanB
estimate
. If endptscale="log"
, 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.
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.
comparisonsTable
methods
code. Therefore any direct use of it needs to be done cautiously.mcadjust=TRUE
, a status message of
"Some time may be needed as the critical point "
"from the multcomp::summary.glht function call is calculated "
is displayed at the console. This computed critical point
is used for all subsequent p-value and confidence interval
calculations.The multcomp package provides a unified way to calculate critical points based on the comparisons of interest in a "family." Thus a user does not need to worry about choosing amongst the myriad names of multiple comparison procedures.
Hothorn, T., Bretz, F., and Westfall, P. (2008). "Simultaneous Inference in General Parametric Models", Biometrical Journal, 50, 3, 346-363.
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)
## Easier way: notice the comparisonsTable call
comparisonsTable(canine.fit, model="olsonly")
## Manual way
## Instead of comparisonsTable(canine.fit, model="olsonly")
comparisons(estimates=canine.fit@olsfit$coef,
varcovmatrix=vcov(canine.fit@olsfit),
errordf=canine.fit@olsfit$df.residual,
endptscale="log",
analysisname="Canine",
digits=1,
endptname="Prostate Volume")
Run the code above in your browser using DataLab