pairwiseCImethodsCont {pairwiseCI} | R Documentation |
Confidence intervals for two sample comparisons of continuous data
Description
Confidence interval methods available for pairwiseCI for comparison of two independent samples. Methods for continuous variables.
Usage
Param.diff(x, y, conf.level=0.95, alternative="two.sided", ...)
Param.ratio(x, y, conf.level=0.95, alternative="two.sided", ...)
Lognorm.diff(x, y, conf.level=0.95, alternative="two.sided", sim=10000, ...)
Lognorm.ratio(x, y, conf.level=0.95, alternative="two.sided", sim=10000, ...)
HL.diff(x, y, conf.level=0.95, alternative="two.sided", ...)
HL.ratio(x, y, conf.level=0.95, alternative="two.sided", ...)
Median.diff(x, y, conf.level=0.95, alternative="two.sided", ...)
Median.ratio(x, y, conf.level=0.95, alternative="two.sided", ...)
Arguments
x |
vector of observations in the first sample |
y |
vector of observations in the second sample |
alternative |
character string, either "two.sided", "less" or "greater" |
conf.level |
the comparisonwise confidence level of the intervals, where 0.95 is default |
sim |
a single integer value, specifying the number of samples to be drawn for calculation of the empirical distribution of the generalized pivotal quantities |
... |
further arguments to be passed to the individual methods, see details |
Details
-
Param.diff calculates the confidence interval for the difference in means of two Gaussian samples by calling t.test in package stats, assuming homogeneous variances if var.equal=TRUE, and heterogeneous variances if var.equal=FALSE (default);
-
Param.ratio calculates the Fiellers (1954) confidence interval for the ratio of two Gaussian samples by calling ttestratio in package mratios, assuming homogeneous variances if var.equal=TRUE. If heterogeneous variances are assumed (setting var.equal=FALSE, the default), the test by Tamhane and Logan (2004) is inverted by solving a quadratic equation according to Fieller, where the estimated ratio is simply plugged in order to get Satterthwaite approximated degrees of freedom. See Hasler and Vonk (2006) for some simulation results.
-
Lognorm.diff calculates the confidence interval for the difference in means of two Lognormal samples, based on general pivotal quantities (Chen and Zhou, 2006); currently, further arguments (\dots) are not used;
-
Lognorm.ratio calculates the confidence interval for the ratio in means of two Lognormal samples, based on general pivotal quantities (Chen and Zhou, 2006); currently, further arguments (\dots) are not used;
-
HL.diff calculates the Hodges-Lehmann confidence interval for the difference of locations by calling wilcox_test in package coin, further arguments ... are passed to wilcox_test and corresponding methods for Independence problems, for example
distribution
may be used to switch fromexact
(default), to approximate or asymptotic versions; -
HL.ratio calculates a Hodges-Lehmann-like confidence interval for the ratio of locations for positive data by calling wilcox_test in package coin on the logarithms of observations and backtransforming (Hothorn and Munzel, 2002), further arguments ... are passed to wilcox_test and corresponding methods for Independence problems, for example
distribution
may be used to switch fromexact
(default), to approximate or asymptotic versions; -
Median.diff calculates a percentile bootstrap confidence interval for the difference of Medians using boot.ci in package boot, the number of bootstrap replications can be set via R=999 (default);
-
Median.ratio calculates a percentile bootstrap confidence interval for the ratio of Medians using boot.ci in package boot, the number of bootstrap replications can be set via R=999 (default);
Value
A list containing:
conf.int |
a vector containing the lower and upper confidence limit |
estimate |
a single named value |
References
-
Param.diff uses t.test in stats.
-
Fieller EC (1954): Some problems in interval estimation. Journal of the Royal Statistical Society, Series B, 16, 175-185.
-
Tamhane, AC, Logan, BR (2004): Finding the maximum safe dose level for heteroscedastic data. Journal of Biopharmaceutical Statistics 14, 843-856.
-
Hasler, M, Vonk, R, Hothorn, LA: Assessing non-inferiority of a new treatment in a three arm trial in the presence of heteroscedasticity (submitted).
-
Chen, Y-H, Zhou, X-H (2006): Interval estimates for the ratio and the difference of two lognormal means. Statistics in Medicine 25, 4099-4113.
-
Hothorn, T, Munzel, U: Exact Nonparametric Confidence Interval for the Ratio of Medians. Technical Report, Universitaet Erlangen-Nuernberg, Institut fuer Medizininformatik, Biometrie und Epidemiologie, 2002; available via: http://www.statistik.uni-muenchen.de/~hothorn/bib/TH_TR_bib.html.
Examples
data(sodium)
iso<-subset(sodium, Treatment=="xisogenic")$Sodiumcontent
trans<-subset(sodium, Treatment=="transgenic")$Sodiumcontent
iso
trans
## CI for the difference of means,
# assuming normal errors and homogeneous variances :
thomo<-Param.diff(x=iso, y=trans, var.equal=TRUE)
# allowing heterogeneous variances
thetero<-Param.diff(x=iso, y=trans, var.equal=FALSE)
## Fieller CIs for the ratio of means,
# also assuming normal errors:
Fielhomo<-Param.ratio(x=iso, y=trans, var.equal=TRUE)
# allowing heterogeneous variances
Fielhetero<-Param.ratio(x=iso, y=trans, var.equal=FALSE)
HLD<-HL.diff(x=iso, y=trans)
thomo
thetero
Fielhomo
Fielhetero
HLD
# # #
# Lognormal CIs:
x<-rlnorm(n=10, meanlog=0, sdlog=1)
y<-rlnorm(n=10, meanlog=0, sdlog=1)
Lognorm.diff(x=x, y=y)
Lognorm.ratio(x=x, y=y)