Learn R Programming

pairwiseCI (version 0.1-21)

pairwiseCImethodsCont: 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

Value

  • A list containing:
  • conf.inta vector containing the lower and upper confidence limit
  • estimatea single named value

Details

  • Param.diffcalculates the confidence interval for the difference in means of two Gaussian samples by callingt.testin packagestats, assuming homogeneous variances ifvar.equal=TRUE, and heterogeneous variances ifvar.equal=FALSE(default);
  • Param.ratiocalculates the Fiellers (1954) confidence interval for the ratio of two Gaussian samples by callingratio.t.testin packagemratios, assuming homogeneous variances ifvar.equal=TRUE. If heterogeneous variances are assumed (settingvar.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.diffcalculates the confidence interval for the difference in means of two Lognormal samples, based on general pivotal quantities (Chen and Zhou, 2005); currently, further arguments(...)are not used;
  • Lognorm.ratiocalculates the confidence interval for the ratio in means of two Lognormal samples, based on general pivotal quantities (Chen and Zhou, 2005); currently, further arguments(...)are not used;
  • HL.diffcalculates the Hodges-Lehmann confidence interval for the difference of locations by callingwilcox.exactin packageexactRankTests;
  • HL.ratiocalculates the Hodges-Lehmann-like confidence interval for the ratio of locations by callingwilcox.exactin packageexactRankTestsfor the logarithms of observations;
  • Median.diffcalculates a percentile bootstrap confidence interval for the difference of Medians usingboot.ciin packageboot, the number of bootstrap replications can be set viaR=999(default);
  • Median.ratiocalculates a percentile bootstrap confidence interval for the ratio of Medians usingboot.ciin packageboot, the number of bootstrap replications can be set viaR=999(default);

References

  • Param.diffusest.testinstats.
  • 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: Non-parametric confidence interval for the ratio. Report University of Erlangen, Department Medical Statistics 2002; available via:http://www.imbe.med.uni-erlangen.de/~hothorn/.

Examples

Run this code
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)


## Hodges-Lehmann Intervalls for difference and ratios:

HLD<-HL.diff(x=iso, y=trans,)

# allowing heterogeneous variances

HLR<-HL.ratio(x=iso, y=trans,)



MedianD<-Median.diff(x=iso, y=trans,)

# allowing heterogeneous variances

MedianR<-Median.ratio(x=iso, y=trans,)

thomo
thetero

Fielhomo
Fielhetero

HLD
HLR

MedianD
MedianR

# # #

# 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)

Run the code above in your browser using DataLab