Plotting Binomial Distribution

## Description

Here, we will use R to plot a binomial distribution. For a given `n` and `p`, we use the command `dbinom` to produce a range of binomial probabilities from to `n` (in R, a range of integers from `a` tp `b`, inclusively, is defined using `a:b`). We then use the `plot` command to automatically produce a scatter plot of the probabilities.

## Sage Cell

#### Code

```
n = 40
p = 0.50
plot(x=0:n, y=dbinom(0:n, n, p))
```

## Options

#### Plotting probabilities as ln(p)

By setting the `log` property to `TRUE`, we can plot probability `p` as ln(p).

#### Code

```
n = 40
p = 0.50
plot(x=0:n, y=dbinom(0:n, n, p, log = TRUE))
```

## Tags

Primary Tags:

Secondary Tags:

A list of possible tags can be found at The WeBWorK Open Problem Library. For linear algebra tags see the Curated Courses Project.

## Related Cells

Any related cells go here. Provide a link to the page containing the information about the cell.

## Attribute

Permalink:

Author:

Date: 16 Apr 2019 16:13

Submitted by: Zane Corbiere