Learn R Programming

pairwiseCI (version 0.1-21)

pairwiseCImethodsCount: Confidence intervals for two sample comparisons of count data

Description

Confidence interval methods available for pairwiseCI for comparison of two independent samples. Methods for count data.

Usage

Poisson.ratio(x, y, conf.level=0.95, alternative="two.sided")
Quasipoisson.ratio(x, y, conf.level=0.95, alternative="two.sided")
Negbin.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

Value

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

Details

  • Poisson.ratiocalculates a confidence interval for the ratio of means assuming the Poisson distribution of the response by fitting a generalized linear model with log-link usingglmin packagestats, constructing a likelihood profile and deriving a equal-tailed confidence interval from this profile. Please not that confidence intervals from this method produce severely misleading results, when there is extra-Poisson variation in the data.
  • Quasipoisson.ratiocalculates a confidence interval for the ratio of means of the response by fitting a generalized linear model with familyquasipoissonand log-link usingglmin packagestats, constructing a deviance profile and deriving a equal-tailed confidence interval from this profile.
  • Negbin.ratiocalculates a confidence interval for the ratio of means assuming the negative binomial distribution of the response by fitting a generalized linear model with log-link usingglm.nbin packageMASS, constructing a likelihood profile and deriving a equal-tailed confidence interval from this profile.
Note, that for all the methods, a separate glm is fitted for each two-sample comparison! When a common model can be reasonbly assumed for all the data, there are smarter methods of constructing confidence intervals for groupwise comparisons, based on a common model, see e.g. the function confint in package stats, the function confint.glm in package MASS and the function confint.glht in package multcomp. Note, that the code used here is slightly changed from the original code by Venables and Ripley, or Bates and Watts. An limit is imposed on the parameter space in which the profile is constructed. By that limitation, intervals can also be constructed for extreme cases with all observations in one group being zero. Note, that the Poisson.ratio can be used when only one count is present in each group. For Quasipoisson.ratio, Negbin.ratio, repeated observations are necessary in each group.

References

Venables WN and Ripley BD (2002). Modern Applied Statistics using S, Fourth Edition. Springer New York. Bates, D.M. and Watts, D.G.(1988). Nonlinear Regression Analysis and Its Applications. John Wiley and Sons, New York.

Examples

Run this code
library(mratios)

data(Mutagenicity)

QPCI<-pairwiseCI(MN ~ Treatment, data=Mutagenicity,
 alternative="greater", control="Vehicle", method="Quasipoisson.ratio")

plot(QPCI)

Run the code above in your browser using DataLab