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, 2019 829 views

## 1 answer to this question.

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```
• 8,700 points

## 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

## Check Distribution of Categorical Variable in R

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

+1 vote

## Difference between factor and as.factor in R programming

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

+1 vote

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

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

+1 vote

## How to segment documents into phrases in text mining using R?

You can do this in R using ...READ MORE

## 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