Question: The following code makes a graph of the cumulative distribution function for the binomial distribution, that is $F(x) = prob(X le x)$ for $X sim
The following code makes a graph of the cumulative distribution function for the binomial distribution, that is $F(x) = \prob(X \le x)$ for $X \sim \text{Binomial}(7, 0.3)$. This is the function which is calculated by the base R function `pbinom()`.
### 5A
Modify the code to add a horizontal red dotted line at 0.4.
```{r} prob5 = tibble( x = seq(-1,8,1), p = dbinom(x, 7, 0.3), cdf = pbinom(x, 7, 0.3))
ggplot(prob5, aes(x = x, y = cdf )) + geom_step(color = "blue") + geom_hline(yintercept = 0) + scale_x_continuous(breaks = 0:7) + xlab("x") + ylab("Probability") + ggtitle("Binomial(7, 0.3) distribution CDF") + theme_minimal()
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
