R Programming: Perform negative binomial distribution

0 votes

I want to know why I am getting a different answer while using density function in R:

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 11 in Data Analytics by Tyrion anex
• 8,280 points
44 views

1 answer to this question.

0 votes

Try this:

pnbinom(3,2,0.5)

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

This will give the following output:

> pnbinom(3,2,0.5)
[1] 0.8125
> 
> sum(dnbinom(0:3,2,0.5))
[1] 0.8125
answered Mar 11 by Sophie may
• 9,410 points

Related Questions In Data Analytics

0 votes
1 answer

Negative Binomial Distribution in R Programming

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] ...READ MORE

answered Mar 5 in Data Analytics by Tyrion anex
• 8,280 points
33 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,680 points
52 views
0 votes
1 answer

How can I perform word stemming in R

The tm package in R provides the stemDocument() function to stem the ...READ MORE

answered Aug 20, 2018 in Data Analytics by ANMOL
• 3,620 points
40 views
0 votes
1 answer

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

A variable name in R programming language ...READ MORE

answered Sep 7, 2018 in Data Analytics by zombie
• 3,690 points
69 views
0 votes
1 answer

R programming error

Alright, you can either use gsub to match the ...READ MORE

answered Dec 18, 2018 in Data Analytics by Tyrion anex
• 8,280 points
16 views
0 votes
1 answer

R Programming error in 'fert'

You're using a factor: fert <- factor(c(50,20,10,10,20,50)) levels(fert) #[1] ...READ MORE

answered Dec 27, 2018 in Data Analytics by Sophie may
• 9,410 points
37 views
0 votes
1 answer

R Programming: Market Basket Analysis Error

The basket.sorted() has less than 5 rules. Refer ...READ MORE

answered Feb 11 in Data Analytics by Sophie may
• 9,410 points
87 views
0 votes
1 answer

R Programming: regexpr error

The below code will help: gregexpr("D", x) # [[1]] # ...READ MORE

answered Feb 21 in Data Analytics by Tyrion anex
• 8,280 points
21 views
0 votes
1 answer

R Programming: matrices

Try this, It will test if a matrix ...READ MORE

answered Dec 17, 2018 in Data Analytics by Sophie may
• 9,410 points
24 views
0 votes
1 answer

R programming: Unexpected symbol error

Format your code this way: myfunction <- function() ...READ MORE

answered Dec 17, 2018 in Data Analytics by Sophie may
• 9,410 points
159 views