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, 2019 in Data Analytics by Tyrion anex
• 8,360 points
94 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, 2019 by Sophie may
• 9,940 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, 2019 in Data Analytics by Tyrion anex
• 8,360 points
123 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,710 points
755 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,680 points
134 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, 2019 in Data Analytics by anonymous
• 32,440 points
302 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,360 points
48 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,940 points
75 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, 2019 in Data Analytics by Sophie may
• 9,940 points
259 views
0 votes
1 answer

R Programming: regexpr error

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

answered Feb 21, 2019 in Data Analytics by Tyrion anex
• 8,360 points
49 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,940 points
49 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,940 points
621 views