Caution
Section omitted to comply with the Honor Code
Bayesian Statistics: From Concept to Data Analysis
Oren Bochman
Random Variables, Homework
Section omitted to comply with the Honor Code
---
title: "Random Variables - M1L3HW1"
subtitle: "Bayesian Statistics: From Concept to Data Analysis"
categories:
- Bayesian Statistics
keywords:
- Random Variables
- Homework
---
::::: {.content-visible unless-profile="HC"}
::: {.callout-caution}
Section omitted to comply with the Honor Code
:::
:::::
::::: {.content-hidden unless-profile="HC"}
::: {#exr-rv-1}
[**random variables**]{.column-margin} When using random variable notation, $X$ denotes what?
::: {.solution .callout-tip collapse=true}
#### Solution: `random variable`.
:::
::::
::: {#exr-rv-2}
[**random variables**]{.column-margin} When using random variable notation, little $x$ or $X=x$ denotes what?
::: {.solution .callout-tip collapse="true"}
#### Solution:
a **realization of a random variable**. It is a possible value the random variable can take.
:::
:::
::: {#exr-rv-3}
When using random variable notation, $X \sim$ denotes what?
:::
::: {.solution .callout-tip collapse="true"}
#### Solution:
**distributed as**.
:::
::: {#exr-rv-4}
What is the value of $f(x)=−5\mathbb{I}_{x>2}(x)+x\mathbb{I}_{x<−1}(x)$ when $x=3$?
:::
::: {.solution .callout-tip collapse="true"}
#### Solution:
5 Only the first term is evaluated as non-zero.
:::
::: {#exr-rv-5}
What is the value of $f(x)=−5\mathbb{I}_{x>2}(x)+x \mathbb{I}_{x<−1}(x)$ when $x=0$?
:::
::: {.solution .callout-tip collapse="true"}
#### Solution:
0 as all indicator functions evaluate to zero.
:::
::: {#exr-rv-6}
Which of the following scenarios could should one model with a Bernoulli RV?
:::
::: {.solution .callout-tip collapse="true"}
#### Solution:
Predicting whether your hockey team wins its next game (tie counts as a loss)
:::
::: {#exr-rv-7}
Calculate the expected value of the following random variable: $X$ takes on values $\{0, 1, 2, 3\}$ with corresponding probabilities $\{0.5, 0.2, 0.2, 0.1\}$.
:::
::: {.solution .callout-tip collapse="true"}
#### Solution:
$0(.5)+1(.2)+2(.2)+3(.1) =0.9$
:::
::: {#exr-rv-8}
Which of the following scenarios could we appropriately model using a binomial RV (with n \> 1)?
:::
::: {.solution .callout-tip collapse="true"}
#### Solution:
Predicting the number of wins in a series of three games against a single opponent (ties count as losses)
:::
::: {#exr-rv-9}
If $X\sim Binomial(3,0.2)$. Calculate $\mathbb{P}r(X=0)$.
:::
::: {.solution .callout-tip collapse="true"}
#### Solution:
```{python}
import math
def binom(n,p,x):
return round(math.comb(n,x) * p**x * (1-p)**(n-x),2)
print(f'{binom(n=3,p=0.2,x=0)=}')
```
:::
::: {#exr-rv-10}
If $X\sim Binomial(3,0.2)$. Calculate $\mathbb{P}r(X \le 2)$.
:::
::: {.solution .callout-tip collapse="true"}
#### Solution:
```{python}
print(f'{binom(n=3,p=0.2,x=0)+binom(n=3,p=0.2,x=1)+binom(n=3,p=0.2,x=2)}')
```
:::
:::::