Learn R Programming

dpcR (version 0.5)

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

dpcr_density(k, n, average = FALSE, methods = "wilson",
  conf.level = 0.95, plot = TRUE, bars = FALSE, ...)

Arguments

k

Total number of positive molecules.

n

Total number of partitions.

average

If TRUE, calculates density of the average number of molecules per partition. If FALSE, instead performs calculations for the total number of positive molecules.

methods

Method for calculating the confidence interval. Possible values are: "wilson", "agresti-coull", "exact", "prop.test", "profile", "lrt", "asymptotic", "bayes", "cloglog", "logit", "probit". Default value is "wilson". See Details.

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 TRUE, plots density plot.

bars

plot on density plot bars for discrete values of lambda.

...

Additional arguments send to plot function.

Value

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

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

Run this code
# NOT RUN {
# 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)

# }

Run the code above in your browser using DataLab