---
title: "Probability III"
output: html_document
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```

### `pbinom` review

Suppose we take a poll of a random sample of 1000 people, and ask them who they will vote for in November. Suppose that in the population `P(DEM) = 0.51`, i.e., 51% of people in the population plan to vote DEM. What is the probability that in our sample, less than 50% of people will say they plan to vote DEM?


### The normal approximation to `pbinom`

Recall that we can approximate a $Bin(\theta, n)$ distribution using $\mathcal{N}(\theta \times n, n\times \theta \times (1- \theta))$. Compute the probability that fewer than 50% of people will say DEM

### Intervals

What is the probability that between 48% and 51% will say DEM? Use `pbinom`

### Transforming random normal variables

Suppose $X\sim\mathcal{N}(\mu, \sigma^2)$. We can "shift" $X$ by subtracting $\mu$.

$(X-\mu) \sim \mathcal{N}(0, \sigma^2)$

Using that, how can we compute `pnorm(q = 1, mean = 0.5, sigma = 1.5)` another way?

We can also divide a variable by a constant, "shrinking" it, assuming its mean is 0:

If $Y\sim \mathcal{N}(0, \sigma^2)$, then $Y/a = \sim \mathcal{N}(0, \sigma^2/a^2)$

That means that $(X-\mu)/\sigma \sim \mathcal{N}(0, 1)$. (N.B., \mathcal{N}(0, 1^2) is the "standard normal distribution").

Again, let's recompute `pnorm(q = 1, mean = 0.5, sigma = 1.5)`.

### Average of i.i.d. (independently identically distributed) X's

If $X_i\sim \mathcal{N}(\mu, \sigma^2)$, then 

$\bar{X} = \frac{X_1 + X_2 + ... + X_n}{n} \sim \mathcal{N}(\mu, \sigma^2/n)$
