Consider a \(\text{Binomial}(K, p)\) distribution.

Is a Binomial random variable discrete or continuous? Use the words support and finite in your answer.

Pick values for the population parameters \(K\) and \(p\), store them as variables.

Use

`rbinom(N, K, p)`

to randomly generate observations from the Binomial distribution and store them in a variable.Explain two of these observations in complete English sentences.

Estimate \(P(X = x)\) for some value \(0 < x < K\).

Interpret this number in context of the data.

Estimate \(P(X \geq x)\) for some value \(0 < x < K\).

Interpret this number in context of the data.

Use

`table()`

and`prop.table()`

to create a dataframe of the density function evaluated at each point in the support of your Binomial data. Your dataframe should have two columns, one for the values in the support \(\text{Binomial}(K, p)\) and one for the estimates of the density function.Use

`ggplot()`

to plot the estimated density function.Challenge. Use

`choose()`

to calculate the true density function at each value in the support of \(\text{Binomial}(K, p)\) and add this as a column to your dataframe. Hint: you can assign into`df$newname`

. Then overlay the estimated density function, in orange, over the true density function, in blue, in one plot.

Consider the dataset

`orion`

. Use the Exponential distribution to analyze these data.Is a Exponential random variable discrete or continuous? Use the words support and infinite in your answer.

Write a sentence, in your own words, explaining this dataset and why the Exponential distribution is appropriate for the variable

`diff`

.Use

`ggplot()`

to make a histogram of the variable`diff`

.Use

`ggplot()`

to make a density plot of the variable`diff`

.Challenge. See if you can overlay the two plots. Hint: see this stackoverflow post.

Use the likelihood method to estimate the population parameter \(\lambda\) for the variable

`diff`

.Interpret your estimate in context of the data.

Estimate the expected value of the variable

`diff`

.Interpret your estimate in context of the data.