|
| 1 | +--- |
| 2 | +title : Homework 1 for Stat Inference |
| 3 | +subtitle : Extra problems for Stat Inference |
| 4 | +author : Brian Caffo |
| 5 | +job : Johns Hopkins Bloomberg School of Public Health |
| 6 | +framework : io2012 |
| 7 | +highlighter : highlight.js |
| 8 | +hitheme : tomorrow |
| 9 | +#url: |
| 10 | +# lib: ../../librariesNew #Remove new if using old slidify |
| 11 | +# assets: ../../assets |
| 12 | +widgets : [mathjax, quiz, bootstrap] |
| 13 | +mode : selfcontained # {standalone, draft} |
| 14 | +--- |
| 15 | +```{r setup, cache = F, echo = F, message = F, warning = F, tidy = F, results='hide'} |
| 16 | +# make this an external chunk that can be included in any file |
| 17 | +library(knitr) |
| 18 | +options(width = 100) |
| 19 | +opts_chunk$set(message = F, error = F, warning = F, comment = NA, fig.align = 'center', dpi = 100, tidy = F, cache.path = '.cache/', fig.path = 'fig/') |
| 20 | +
|
| 21 | +options(xtable.type = 'html') |
| 22 | +knit_hooks$set(inline = function(x) { |
| 23 | + if(is.numeric(x)) { |
| 24 | + round(x, getOption('digits')) |
| 25 | + } else { |
| 26 | + paste(as.character(x), collapse = ', ') |
| 27 | + } |
| 28 | +}) |
| 29 | +knit_hooks$set(plot = knitr:::hook_plot_html) |
| 30 | +runif(1) |
| 31 | +``` |
| 32 | + |
| 33 | +## About these slides |
| 34 | +- These are some practice problems for Statistical Inference Quiz 1 |
| 35 | +- They were created using slidify interactive which you will learn in |
| 36 | +Creating Data Products |
| 37 | +- Please help improve this with pull requests here |
| 38 | +(https://github.com/bcaffo/courses) |
| 39 | + |
| 40 | + |
| 41 | +--- &radio |
| 42 | + |
| 43 | +Consider influenza epidemics for two parent heterosexual families. Suppose that the probability is 15% that at least one of the parents has contracted the disease. The probability that the father has contracted influenza is 6% while that the mother contracted the disease is 5%. What is the probability that both contracted influenza expressed as a whole number percentage? |
| 44 | + |
| 45 | +1. 15% |
| 46 | +2. 6% |
| 47 | +3. 5% |
| 48 | +4. _2%_ |
| 49 | + |
| 50 | +*** .hint |
| 51 | +$A = Father$, $P(A) = .06$, $B = Mother$, $P(B) = .05$ |
| 52 | +$P(A\cup B) = .15$, |
| 53 | + |
| 54 | +*** .explanation |
| 55 | +$P(A\cup B) = P(A) + P(B) - 2 P(AB)$ thus |
| 56 | +$$.15 = .06 + .05 - 2 P(AB)$$ |
| 57 | +```{r} |
| 58 | +(0.15 - .06 - .05) / 2 |
| 59 | +``` |
| 60 | + |
| 61 | +--- &radio |
| 62 | + |
| 63 | +A random variable, $X$, is uniform, a box from $0$ to $1$ of height $1$. (So that it's density is $f(x) = 1$ for $0\leq x \leq 1$.) What is it's median expressed to two decimal places? </p> |
| 64 | + |
| 65 | +1. 1.00 |
| 66 | +2. 0.75 |
| 67 | +3. _0.50_ |
| 68 | +4. 0.25 |
| 69 | + |
| 70 | +*** .hint |
| 71 | +The median is the point so that 50% of the density lies below it. |
| 72 | + |
| 73 | +*** .explanation |
| 74 | +This density looks like a box. So, notice that $P(X \leq x) = width\times height = x$. |
| 75 | +We want $.5 = P(X\leq x) = x$. |
| 76 | + |
| 77 | +--- &radio |
| 78 | + |
| 79 | +You are playing a game with a friend where you flip a coin and if it comes up heads you give her $X$ dollars and if it comes up tails she gives you $Y$ dollars. The odds that the coin is heads in $d$. What is your expected earnings? |
| 80 | + |
| 81 | +1. _$-X \frac{d}{1 + d} + Y \frac{1}{1+d} $_ |
| 82 | +2. $X \frac{d}{1 + d} + Y \frac{1}{1+d} $ |
| 83 | +3. $X \frac{d}{1 + d} - Y \frac{1}{1+d} $ |
| 84 | +4. $-X \frac{d}{1 + d} - Y \frac{1}{1+d} $ |
| 85 | + |
| 86 | +*** .hint |
| 87 | +The probability that you win on a given round is given by $p / (1 - p) = d$ which implies |
| 88 | +that $p = d / (1 + d)$. |
| 89 | + |
| 90 | +*** .explanation |
| 91 | +You lose $X$ with probability $p = d/(1 +d)$ and you win $Y$ with probability $1-p = 1/(1 + d)$. So your answer is |
| 92 | +$$ |
| 93 | +-X \frac{d}{1 + d} + Y \frac{1}{1+d} |
| 94 | +$$ |
| 95 | + |
| 96 | +--- &radio |
| 97 | +A random variable takes the value -4 with probabability .2 and 1 with proabability .8. What |
| 98 | +is the variance of this random variable? |
| 99 | + |
| 100 | +1. 0 |
| 101 | +2. _4_ |
| 102 | +3. 8 |
| 103 | +4. 16 |
| 104 | + |
| 105 | +*** .hint |
| 106 | +This random variable has mean 0. The variance would be given by $E[X^2]$ then. |
| 107 | + |
| 108 | +*** .explanation |
| 109 | +$$E[X] = 0$$ |
| 110 | +$$ |
| 111 | +Var(X) = E[X^2] = (-4)^2 * .2 + (1)^2 * .8 |
| 112 | +$$ |
| 113 | +```{r} |
| 114 | +-4 * .2 + 1 * .8 |
| 115 | +(-4)^2 * .2 + (1)^2 * .8 |
| 116 | +``` |
| 117 | + |
| 118 | + |
| 119 | +--- &radio |
| 120 | +If $\bar X$ and $\bar Y$ are comprised of $n$ iid random variables arising from distributions |
| 121 | +having means $\mu_x$ and $\mu_y$, respectively and common variance $\sigma^2$ |
| 122 | +what is the variance $\bar X - \bar Y$? |
| 123 | + |
| 124 | +1. 0 |
| 125 | +2. _$2\sigma^2/n$_ |
| 126 | +3. $\mu_x$ - $\mu_y$ |
| 127 | +4. $2\sigma^2$ |
| 128 | + |
| 129 | +*** .hint |
| 130 | +Remember that $Var(\bar X) = Var(\bar Y) = \sigma^2 / n$. |
| 131 | + |
| 132 | +*** .explanation |
| 133 | +$$ |
| 134 | +Var(\bar X - \bar Y) = Var(\bar X) + Var(\bar Y) = \sigma^2 / n + \sigma^2 / n |
| 135 | +$$ |
| 136 | + |
| 137 | +--- &radio |
| 138 | +Let $X$ be a random variable having standard deviation $\sigma$. What can |
| 139 | +be said about $X /\sigma$? |
| 140 | + |
| 141 | +1. Nothing |
| 142 | +2. _It must have variance 1._ |
| 143 | +3. It must have mean 0. |
| 144 | +4. It must have variance 0. |
| 145 | + |
| 146 | +*** .hint |
| 147 | +$Var(aX) = a^2 Var(X)$ |
| 148 | + |
| 149 | +*** .explanation |
| 150 | +$$Var(X / \sigma) = Var(X) / \sigma^2 = 1$$ |
| 151 | + |
| 152 | + |
| 153 | +--- &radio |
| 154 | +If a continuous density that never touches the horizontal axis is symmetric about zero, can we say that its associated median is zero? |
| 155 | + |
| 156 | +1. _Yes_ |
| 157 | +2. No. |
| 158 | +3. It can not be determined given the information given. |
| 159 | + |
| 160 | +*** .explanation |
| 161 | +This is a surprisingly hard problem. The easy explanation is that 50% of the probability |
| 162 | +is below 0 and 50% is above so yes. However, it is predicated on the density not being |
| 163 | +a flat line at 0 around 0. That's why the caveat that it never touches the horizontal axis |
| 164 | +is important. |
| 165 | + |
| 166 | + |
| 167 | +--- &radio |
| 168 | + |
| 169 | +Consider the following pmf given in R |
| 170 | +```{r} |
| 171 | +p <- c(.1, .2, .3, .4) |
| 172 | +x <- 2 : 5 |
| 173 | +``` |
| 174 | +What is the variance expressed to 1 decimal place? |
| 175 | + |
| 176 | +1. _1.0_ |
| 177 | +2. 4.0 |
| 178 | +3. 6.0 |
| 179 | +4. 17.0 |
| 180 | + |
| 181 | +*** .hint |
| 182 | +The variance is $E[X^2] - E[X^2]$ |
| 183 | + |
| 184 | +*** .explanation |
| 185 | +```{r} |
| 186 | +sum(x ^ 2 * p) - sum(x * p) ^ 2 |
| 187 | +``` |
0 commit comments