Description Usage Arguments Details Value Author(s) See Also Examples

Generate a plot showing the quality of the fit of the Poisson lognormal to the data.

1 | ```
ppplot(n, n.points=10)
``` |

`n` |
vector of observed counts |

`n.points` |
number of points on the graph to highlight |

The function fits the Poisson lognormal to the raw read counts `n`

and uses that
to generate theoretical percents for a PP (“percent-percent” or “probability-probability”)
plot. A perfect fit falls on the diagonal (marked with a dotted line).

The optional `n.points`

plots some extra points on the graph. The first point (the lower-left-most)
represents the fraction of all OTUs that have 1 count in the empirical (x-axis) and theoretical
(y-axis) distributions. The second point represents OTUs with 1 or 2 counts. The third point
represents OTUs with up to 3 counts, and so on.

a `ggplot`

object whose default `data`

object has columns `empirical`

and `theoretical`

Scott Olesen swo@mit.edu

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | ```
# make up some data
n <- rpoilog(1000, 1.0, 1.0)
# plot it
p <- ppplot(n)
p
# compare to the lognormal's fit
# first, make the empirical cumulative distribution function from the data
x <- tabulate(n + 1)
empirical <- cumsum(x / sum(x))
# then, get the theoretical percents
theoretical <- plnorm(0:max(n), meanlog=mean(log(n)), sdlog=sd(log(n)))
lognormal.fit <- data.frame(empirical=empirical, theoretical=theoretical)
# add that data in a new layer
p + geom_line(data=lognormal.fit, color='red')
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.