Skip to content

Instantly share code, notes, and snippets.

@rpcgen
Created February 15, 2013 09:44
Show Gist options
  • Save rpcgen/4959409 to your computer and use it in GitHub Desktop.
Save rpcgen/4959409 to your computer and use it in GitHub Desktop.
Chart to explain Negative Binomial distribution
png("chart_nevative_binomial.png", height = 300, width = 1000)
par(mfrow = c(1,3))
barplot(dnbinom(0:25, 5, 0.4), ylim = c(0, 0.20), col = "blue",
ylab = "probability",
main = "p = 0.4")
barplot(dnbinom(0:25, 5, 0.5), ylim = c(0, 0.20), col = "blue",
ylab = "probability",
main = "p = 0.5")
barplot(dnbinom(0:25, 5, 0.6), ylim = c(0, 0.20), col = "blue",
ylab = "probability",
main = "p = 0.6")
dev.off()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment