The test for comparing ratio of two Poisson means: \(r = \frac{\lambda_1}{\lambda_2}\).
test_ratio(dpcr1, dpcr2, alternative = c("two.sided", "less", "greater"), conf.level = 0.95)
adpcr
or
dpcr
. See Details.adpcr
or
dpcr
. See Details.two.sided
,
greater
or less
.An object of class `htest' containing the following components:
Objects dpcr1
and dpcr2
can be:
adpcr
objects with type tnp
(total number of
positive wells in panel) or nm
(number of molecules per partition).
dpcr
objects with type tnp
(total number of
positive droplets) or nm
(number of molecules per droplet). 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.
Fay M.P. Two-sided exact tests and matching confidence intervals for discrete data R Journal 2 (1), 2010.
See also poisson.test
.
# Input values are numeric vectors representing dPCR experiments x1 <- rpois(765, 1.1) x2 <- rpois(765, 1.1) test_ratio(x1, x2)#> #> Exact Rate Ratio Test, assuming Poisson counts #> #> data: dPCR 1: positive partitions: 506; total partitions: 765. #> dPCR 2: positive partitions: 497; total partitions: 765. #> p-value = 0.8006 #> alternative hypothesis: two.sided #> 95 percent confidence interval: #> 0.8977905 1.1545930 #> sample estimates: #> Lambda1 Lambda2 Lambda1/Lambda2 #> 1.083048 1.048889 1.018109 #># 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))#> #> Exact Rate Ratio Test, assuming Poisson counts #> #> data: dPCR 1: positive partitions: 527; total partitions: 765. #> dPCR 2: positive partitions: 518; total partitions: 765. #> p-value = 0.8046 #> alternative hypothesis: two.sided #> 95 percent confidence interval: #> 0.8994722 1.1507697 #> sample estimates: #> Lambda1 Lambda2 Lambda1/Lambda2 #> 1.167605 1.130487 1.017375 #># It is possible to mix different types of input as long as they have # the same class test_ratio(c(x3, 765), x1)#> #> Exact Rate Ratio Test, assuming Poisson counts #> #> data: dPCR 1: positive partitions: 527; total partitions: 765. #> dPCR 2: positive partitions: 506; total partitions: 765. #> p-value = 0.5338 #> alternative hypothesis: two.sided #> 95 percent confidence interval: #> 0.920138 1.178967 #> sample estimates: #> Lambda1 Lambda2 Lambda1/Lambda2 #> 1.167605 1.083048 1.041502 #># 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)#> #> Exact Rate Ratio Test, assuming Poisson counts #> #> data: dPCR 1: positive partitions: 329; total partitions: 1600. #> dPCR 2: positive partitions: 355; total partitions: 1600. #> p-value = 0.3391 #> alternative hypothesis: two.sided #> 95 percent confidence interval: #> 0.7952394 1.0797878 #> sample estimates: #> Lambda1 Lambda2 Lambda1/Lambda2 #> 0.2301996 0.2508681 0.9267606 #>x7 <- sim_dpcr(400, 1600, 100, pos_sums = TRUE, n_exp = 1) x8 <- sim_dpcr(400, 1600, 100, pos_sums = FALSE, n_exp = 1) test_ratio(x7, x8)#> #> Exact Rate Ratio Test, assuming Poisson counts #> #> data: dPCR 1: positive partitions: 346; total partitions: 1600. #> dPCR 2: positive partitions: 328; total partitions: 1600. #> p-value = 0.5126 #> alternative hypothesis: two.sided #> 95 percent confidence interval: #> 0.9043607 1.2306464 #> sample estimates: #> Lambda1 Lambda2 Lambda1/Lambda2 #> 0.2436652 0.2294132 1.0548780 #>