Skip to content
Related Articles

Related Articles

Compute the Value of Negative Binomial Quantile Function in R Programming – qnbinom() Function
  • Last Updated : 25 Jun, 2020
GeeksforGeeks - Summer Carnival Banner

qnbinom() function in R Language is used to compute the value of negative binomial quantile function. It also creates a density plot of the negative binomial quantile function.

Syntax: qnbinom(vec, size, prob)

Parameters:
vec: x-values for binomial density
size: Number of trials
prob: Probability

Example 1:




# R program to compute value of
# Negative Binomial Quantile Function
  
# Vector of x-values
x <- seq(0, 1, by = 0.1)
  
# Calling qnbinom() Function
y <- qnbinom(x, size = 100, prob = 0.5)
y

Output:



 [1]   0  82  88  92  96  99 103 107 112 118 Inf

Example 2:




# R program to compute value of
# Negative Binomial Quantile Function
  
# Vector of x-values
x <- seq(0, 1, by = 0.01)
  
# Calling qnbinom() Function
y <- qnbinom(x, size = 100, prob = 0.8)
  
# Plot a graph
plot(y)

Output:

Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.

My Personal Notes arrow_drop_up
Recommended Articles
Page :