Learn R Programming

dpcR (version 0.1.2-1)

test_ratio: Rate ratio test

Description

The test for comparing ratio of two Poisson means: $r = \frac{\lambda_1}{\lambda_2}$.

Usage

## S3 method for class 'numeric,numeric':
test_ratio(dpcr1, dpcr2, alternative = c("two.sided", "less", 
                                        "greater"),conf.level = 0.95)
## S3 method for class 'adpcr,adpcr':
test_ratio(dpcr1, dpcr2, alternative = c("two.sided", "less", "greater"),
                                    conf.level = 0.95)
## S3 method for class 'ddpcr,ddpcr':
test_ratio(dpcr1, dpcr2, alternative = c("two.sided", "less", "greater"),
                                    conf.level = 0.95)

Arguments

dpcr1
a (non-empty) numeric vector of data values of length 2 or more or an object of class adpcr or ddpcr. See Details.
dpcr2
a (non-empty) numeric vector of data values of length 2 or more or an object of class adpcr or ddpcr. See Details.
alternative
alternative hypothesis, must be one of: two.sided, greater or less.
conf.level
confidence level for the returned confidence interval.

Value

  • An object of class `htest' containing the following components:
  • p.valuethe p-value of the test
  • estimatea vector with the means (lambdas) of both experiments and their ratio
  • conf.intconfidence interval for ratio between two experiments.
  • alternativetype of alternative hypothesis
  • methoddescription of method
  • data.namedescription of data

Details

Objects dpcr1 and dpcr2 can be:
  1. numeric vectors of length 2. The first element is assumed to be number of positive partitions and the second one to be the total number of partitions.
  2. numeric vectors of length greater than 2. The length of vector is assumed to represent total number of partitions. Every element of the vector with value bigger than 0 is assumed to be a positive partitions.
  3. adpcrobjects with typetp(total number of positive wells in panel) ornm(number of molecules per partition).ddpcrobjects with typetp(total number of positive droplets) ornm(number of molecules per droplet).
Both dpcr1 and dpcr2 must have the same class. See Examples. The ratio_test is a wrapper around rateratio.test function with custom input and output tailored specifically for digital PCR experiments.

References

Fay M.P. Two-sided exact tests and matching confidence intervals for discrete data R Journal 2 (1), 2010.

See Also

See also poisson.test.

Examples

Run this code
# Input values are numeric vectors representing dPCR experiments
x1 <- rpois(765, 1.1)
x2 <- rpois(765, 1.1)
test_ratio(x1, x2)

# Input values represent only number of positive partitions and total 
# partitions
x3 <- sum(rpois(765, 1.1) > 0)
x4 <- sum(rpois(765, 1.1) > 0)
test_ratio(c(x3, 765), c(x4, 765))

# It is possible to mix different types of input as long as they have 
# the same class
test_ratio(c(x3, 765), x1)

# The same is true for adpcr and dpcr objects.
x5 <- sim_adpcr(400, 1600, 100, pos_sums = TRUE, n_panels = 1)
x6 <- sim_adpcr(400, 1600, 100, pos_sums = FALSE, n_panels = 1)
test_ratio(x5, x6)

x7 <- sim_ddpcr(400, 1600, 100, pos_sums = TRUE, n_exp = 1)
x8 <- sim_ddpcr(400, 1600, 100, pos_sums = FALSE, n_exp = 1)
test_ratio(x7, x8)

Run the code above in your browser using DataLab