R: Degrees of Freedom Accoding to Satterthwaite (1946) for...
DfSattRat
R Documentation
Degrees of Freedom Accoding to Satterthwaite (1946) for Ratios of Means
Description
Degrees of freedom accoding to Satterthwaite (1946) for (multivariate)
t-distributions related to multiple contrast tests or corresponding
simultaneous confidence intervals for ratios of means.
Usage
DfSattRat(n, sd, type = "Dunnett", base = 1, Num.Contrast = NULL, Den.Contrast = NULL,
Margin = NULL)
Arguments
n
a vector of numbers of observations
sd
a vector of standard deviations
type
a character string, defining the type of contrast, with the following
options:
"Dunnett": many-to-one comparisons
"Tukey": all-pair comparisons
"Sequen": comparisons of consecutive groups
"AVE": comparison of each group with average of all others
"GrandMean": comparison of each group with grand mean of all
groups
"Changepoint": differences of averages of groups of higher
order to averages of groups of lower order
"Marcus": Marcus contrasts
"McDermott": McDermott contrasts
"Williams": Williams trend tests
"UmbrellaWilliams": Umbrella-protected Williams trend tests
note that type is ignored if ContrastMat is specified
by the user (see below)
base
a single integer specifying the control group for Dunnett contrasts,
ignored otherwise
Num.Contrast
a numerator contrast matrix, where columns correspond to
groups and rows correspond to contrasts
Den.Contrast
a denominator contrast matrix, where columns correspond to
groups and rows correspond to contrasts
Margin
a single numeric value, or a numeric vector with length equal to
the number of contrasts, default is 1
Details
The calculation of critical values or (adjusted) p-values related to multiple
contrast tests or corresponding simultaneous confidence intervals is based on a
multivariate t-distribution. For homoscedastic data, the respective degree of
freedom only depends on the total sample size and the number of groups. A simple and
well-known special case ist the usual t-test. If the data are heteroscedastic,
however, the degree of freedom of a usual t-test must be decreased according
to Welch (1938) to come to an approximate solution. Degrees of freedom according to
Satterthwaite (1946) refer to any linear combinations (contrasts) of normal means.
They are applied, for example, when doing multiple contrast tests for heteroscedastic
data according to Hasler and Hothorn (2008) or Hasler (2014). Like Welch (1938),
Satterthwaite (1946) approximated the degree of freedom by matching first and second
moments. The approach of Satterthwaite (1946) is extended here to the case where
ratios of means are of interest instead of differences. The resulting degree of
freedom then depends on the numerator contrast, the denominator contrast, the
(relative) margin which is tested against, and on the sample sizes and sample
variances per group, respectively. If Margin=1 or Margin=NULL
(default), the result coincides with the result of DfSattDiff().
Value
A vector of degrees of freedom.
Note
The commands SimTestRat() and SimCiRat() use these degrees of
freedom automatically if covar.equal=FALSE (default). You don't need to apply
DfSattRat() additionally.
Author(s)
Mario Hasler
References
Hasler, M. (2014): Multiple contrast tests for multiple endpoints in the presence of
heteroscedasticity. The International Journal of Biostatistics 10, 17–28.
Hasler, M. and Hothorn, L.A. (2008): Multiple contrast tests in the presence of
heteroscedasticity. Biometrical Journal 50, 793–800.
Satterthwaite, F.E. (1946): An approximate distribution of estimates of variance
components. Biometrics 2, 110–114.
See Also
DfSattDiff
Examples
# Example 1:
# Degrees of freedom for a non-inferiority test of group two and three against group one,
# assuming unequal standard deviations for the groups. This is an extension for the well-
# known Dunnett-test to the case of heteroscedasticity and in terms of ratios of means
# instead of differences.
# Either by specifying the type of contrast:
DfSattRat(n=c(10,6,6), sd=c(1,3,6), type="Dunnett", base=1, Margin=0.8)
# Or by specifying the contrast matrices:
DfSattRat(n=c(10,6,6), sd=c(1,3,6), Num.Contrast=rbind(c(0,1,0),c(0,0,1)),
Den.Contrast=rbind(c(1,0,0),c(1,0,0)), Margin=0.8)
# Example 2:
# Degrees of freedom for an all-pair comparison of the groups B, H and S on endpoint ADP,
# assuming unequal standard deviations for the groups. This is an extension for the well-
# known Tukey-test to te case of heteroscedasticity and in terms of ratios of means
# instead of differences.
data(coagulation)
DfSattRat(n=tapply(X=coagulation$ADP, INDEX=coagulation$Group, FUN=length),
sd=tapply(X=coagulation$ADP, INDEX=coagulation$Group, FUN=sd),
type="Tukey")
# These are the same degrees of freedom as used automatically by command
# code{SimTestRat()}:
test <- SimTestRat(data=coagulation, grp="Group", resp="ADP", type="Tukey",
covar.equal=FALSE)
test$degr.fr
Results
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(SimComp)
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/SimComp/DfSattRat.Rd_%03d_medium.png", width=480, height=480)
> ### Name: DfSattRat
> ### Title: Degrees of Freedom Accoding to Satterthwaite (1946) for Ratios
> ### of Means
> ### Aliases: DfSattRat
> ### Keywords: math misc
>
> ### ** Examples
>
> # Example 1:
> # Degrees of freedom for a non-inferiority test of group two and three against group one,
> # assuming unequal standard deviations for the groups. This is an extension for the well-
> # known Dunnett-test to the case of heteroscedasticity and in terms of ratios of means
> # instead of differences.
>
> # Either by specifying the type of contrast:
> DfSattRat(n=c(10,6,6), sd=c(1,3,6), type="Dunnett", base=1, Margin=0.8)
2/1 3/1
5.430277 5.106913
>
> # Or by specifying the contrast matrices:
> DfSattRat(n=c(10,6,6), sd=c(1,3,6), Num.Contrast=rbind(c(0,1,0),c(0,0,1)),
+ Den.Contrast=rbind(c(1,0,0),c(1,0,0)), Margin=0.8)
C1 C2
5.430277 5.106913
>
> # Example 2:
> # Degrees of freedom for an all-pair comparison of the groups B, H and S on endpoint ADP,
> # assuming unequal standard deviations for the groups. This is an extension for the well-
> # known Tukey-test to te case of heteroscedasticity and in terms of ratios of means
> # instead of differences.
>
> data(coagulation)
>
> DfSattRat(n=tapply(X=coagulation$ADP, INDEX=coagulation$Group, FUN=length),
+ sd=tapply(X=coagulation$ADP, INDEX=coagulation$Group, FUN=sd),
+ type="Tukey")
H/B S/B S/H
20.23116 12.24631 14.26914
>
> # These are the same degrees of freedom as used automatically by command
> # code{SimTestRat()}:
> test <- SimTestRat(data=coagulation, grp="Group", resp="ADP", type="Tukey",
+ covar.equal=FALSE)
> test$degr.fr
H/B S/B S/H
20.23116 12.24631 14.26914
>
>
>
>
>
> dev.off()
null device
1
>