Negative Binomial Distribution in R Programming

0 votes

Why do I get a different answer when I use the density function?

pnbinom(3,2,.5)
#[1] 0.8125

a=dnbinom(5,0,0.5)+dnbinom(4,1,.5)+dnbinom(3,2,.5)
a
#[1] 0.15625
Mar 5 in Data Analytics by Sophie may
• 9,870 points
77 views

1 answer to this question.

0 votes

You can try this:

pnbinom(3,2,0.5)

sum(dnbinom(0:3,2,0.5))

Here's the output:

> pnbinom(3,2,0.5)
[1] 0.8125
> 
> sum(dnbinom(0:3,2,0.5))
[1] 0.8125
answered Mar 5 by Tyrion anex
• 8,310 points

Related Questions In Data Analytics

0 votes
1 answer

R Programming: Perform negative binomial distribution

Try this: pnbinom(3,2,0.5) sum(dnbinom(0:3,2,0.5)) This will give the following output: > ...READ MORE

answered Mar 11 in Data Analytics by Sophie may
• 9,870 points
67 views
0 votes
1 answer

Check Distribution of Categorical Variable in R

Consider the iris dataset use the table() function ...READ MORE

answered Jul 30, 2018 in Data Analytics by CodingByHeart77
• 3,690 points
356 views
0 votes
2 answers

What are the rules to define a variable name in R programming language?

The same rules almost follow for all ...READ MORE

answered Aug 26 in Data Analytics by anonymous
• 32,260 points
122 views
0 votes
1 answer

Difference between factor and as.factor in R programming

Hey @Ali, as.factor is a wrapper for ...READ MORE

answered Oct 29, 2018 in Data Analytics by Maverick
• 10,040 points
582 views
0 votes
1 answer

Error saying "vector size cannot be NA" when using R with data mining

You can use the removesparseterm function.  Removes sparse ...READ MORE

answered Nov 15, 2018 in Data Analytics by Maverick
• 10,040 points
592 views
+1 vote
2 answers
0 votes
1 answer

Trying to find frequent itemsets of a data set using arules package

Try replacing ID <- c("A123","A123","A123","A123","B456","B456","B456") item <- c("bread", "butter", "milk", ...READ MORE

answered Nov 15, 2018 in Data Analytics by Maverick
• 10,040 points
46 views
0 votes
1 answer

Error saying "Error in df$item : object of type 'closure' is not subsettable" when trying to use arules package

Try replacing ID <- c("A123","A123","A123","A123","B456","B456","B456") item <- c("bread", "butter", ...READ MORE

answered Nov 15, 2018 in Data Analytics by Maverick
• 10,040 points
207 views
0 votes
1 answer

Check if a matrix is diagonalizable in R Programming Language

On a given matrix, a, the first way ...READ MORE

answered Dec 24, 2018 in Data Analytics by Tyrion anex
• 8,310 points
54 views
0 votes
2 answers