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

```pnbinom(3,2,.5)
# 0.8125

a=dnbinom(5,0,0.5)+dnbinom(4,1,.5)+dnbinom(3,2,.5)
a
# 0.15625``` Mar 12, 2019 260 views

## 1 answer to this question.

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)
 0.8125
>
> sum(dnbinom(0:3,2,0.5))
 0.8125``` answered Mar 12, 2019 by
• 10,590 points

## 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)  ...READ MORE

## Check Distribution of Categorical Variable in R

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

## How can I perform word stemming in R

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

+1 vote

## R programming error

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

## R Programming error in 'fert'

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

+1 vote

+1 vote

## R Programming: regexpr error

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

+1 vote