# Calculate Density of Single dPCR Run

### Description

Calculates and plots the density of the number of positive molecules or the average number of molecules per partition. Can be used for both array digital PCR and droplet digital PCR.

### Usage

1 2 |

### Arguments

`k` |
Total number of positive molecules. |

`n` |
Total number of partitions. |

`average` |
If |

`methods` |
Method for calculating the confidence interval.
Possible values are: |

`conf.level` |
The level of confidence to be used in the confidence interval. Values from 0 to 1 and -1 to 0 are acceptable. |

`plot` |
If |

`bars` |
plot on density plot bars for discrete values of lambda. |

`...` |
Additional arguments send to |

### Value

A data frame with one row containing bounds of the confidence intervals and a name of the method used to calculate them.

### Author(s)

Michal Burdukiewicz, Stefan Roediger.

### References

Brown, Lawrence D., T. Tony Cai, and Anirban DasGupta.
*Confidence Intervals for a Binomial Proportion and Asymptotic
Expansions.* The Annals of Statistics 30, no. 1 (February 2002): 160–201.

### See Also

Computation of confidence intervals: binom.confint,

The browser-based graphical user interface for this function: dpcr_density_gui.

### Examples

1 2 3 4 5 6 7 8 9 10 11 12 13 14 | ```
# Calculate the average number of molecules per partition and show the area
# of the confidence interval (left plot) and the area within the
# confidence interval
par(mfrow = c(1,2))
dpcr_density(k = 25, n = 55, average = TRUE, methods = "wilson",
conf.level = 0.95)
dpcr_density(k = 25, n = 55, average = TRUE, methods = "wilson",
conf.level = -0.95)
par(mfrow = c(1,1))
# By setting average to FALSE the total number of positive molecules is
# calculated
dpcr_density(k = 25, n = 55, average = FALSE, methods = "wilson",
conf.level = 0.95)
``` |