dnbinom_new | R Documentation |
Density for the negative binomial distribution with parameters mu, sd, var, size or prob. See dnbinom
.
dnbinom_new(
x,
size = NULL,
prob = NULL,
mu = NULL,
sd = NULL,
var = NULL,
log = FALSE
)
x |
vector of (non-negative integer) quantiles. |
size |
target for number of successful trials, or dispersion parameter (the shape parameter of the gamma mixing distribution). Must be strictly positive, need not be integer. |
prob |
probability of success in each trial. 0 < prob <= 1. |
mu |
alternative parametrization via mean. |
sd |
alternative parametrization via standard deviation. |
var |
alternative parametrization via variance. |
log |
logical; if TRUE, probabilities p are given as log(p). |
dnbinom_new returns density for the negative binomial distribution
Random numbers for the negative binomial distribution
Marc Girondot marc.girondot@gmail.com
## Not run:
library("HelpersMG")
set.seed(1)
x <- rnbinom_new(n=100, mu=2, sd=3)
LnL <- NULL
df <- data.frame(mu=seq(from=0.1, to=8, by=0.1), "-LnL"=NA)
for (mu in df[, "mu"])
LnL <- c(LnL, -sum(dnbinom_new(x=x, mu=mu, sd=3, log=TRUE)))
df[, "-LnL"] <- LnL
ggplot(data = df, aes(x = .data[["mu"]], y = .data[["-LnL"]])) + geom_line()
# Examples of wrong parametrization
dnbinom_new(x=x, mu=c(1, 2), sd=3, log=TRUE)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.