-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4449434
commit b38d305
Showing
28 changed files
with
2,978 additions
and
0 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
--- | ||
title: "Assignment 1b" | ||
author: "Satvik Saha" | ||
date: "`r Sys.Date()`" | ||
output: | ||
pdf_document: default | ||
--- | ||
|
||
```{r setup, include=FALSE} | ||
knitr::opts_chunk$set(echo = TRUE) | ||
``` | ||
|
||
## Answer 1 | ||
|
||
(a) The three challenges of statistical inference^[As per _Regression and Other Stories (Gelman, Hill, Vehtari)_] are as follows. | ||
(i) _Generalizing from a sample to the population_. | ||
(ii) _Generalizing from the treatment group to the control group_. | ||
(iii) _Generalizing from the observed measurements to the underlying construct_. | ||
|
||
(b) The data and examples from the textbook are available at [https://avehtari.github.io/ROS-Examples/examples.html](https://avehtari.github.io/ROS-Examples/examples.html). | ||
|
||
|
||
## Answer 2 | ||
|
||
(a) Consider the problem of trying to gauge the (relative) popularity of different chess players, by examining social media interaction. By sampling from social media posts or users, we can only access a population of chess enthusiasts _who use social media_. It is difficult to generalize to the population of chess enthusiasts as a whole; it is conceivable that the opinions of older chess enthusiasts (who may not use social media as frequently) will be underrepresented. | ||
(b) Consider the problem of determining which color (or design) in an advertisement is most effective. If two competing designs are tested against two groups of people, there are a lot of adjustments that have to be made to account for differences between the groups, such as demand for the advertised item (perhaps affected by income, presence of competing brands, etc) or modes of advertisement. | ||
(c) Consider the problem of ranking countries according to some 'happiness index'. Of course, the notion of _happiness_ is quite vague and difficult to pin down via reasonable measurements. The World Happiness Index uses factors such as GDP per capita, life expectancy, and perceptions of corruption, to extrapolate some underlying sense of national happiness. |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,125 @@ | ||
--- | ||
title: "Assignment 2a" | ||
author: "Satvik Saha" | ||
date: "`r Sys.Date()`" | ||
output: | ||
pdf_document: default | ||
--- | ||
|
||
```{r setup, include=FALSE} | ||
knitr::opts_chunk$set(echo = TRUE) | ||
knitr::opts_chunk$set(fig.pos = "!H", out.extra = "") | ||
``` | ||
|
||
## Answer 1 | ||
|
||
(a) | ||
```{r 1a} | ||
print(seq(0, 20, by = 0.2)) | ||
``` | ||
|
||
(b) | ||
```{r 1b} | ||
print(runif(1, min = 0, max = 10)) | ||
``` | ||
|
||
(c) | ||
```{r 1c} | ||
print(runif(10, min = 0, max = 10)) | ||
``` | ||
|
||
|
||
## Answer 2 | ||
|
||
(a) | ||
```{r 2a} | ||
a <- c("Magnus Carlsen", "Hilary Hahn", "Linus Torvalds", "Persi Diaconis") | ||
``` | ||
|
||
(b) | ||
```{r 2b} | ||
sample(a, 1) | ||
``` | ||
|
||
(c) | ||
```{r 2c} | ||
x <- seq(0, 10, by = 0.5) | ||
y <- sqrt(x) | ||
plot(x, y) | ||
``` | ||
|
||
(d) | ||
```{r 2d} | ||
x <- seq(0, 10, length.out = 500) | ||
y <- sqrt(x) | ||
plot(x, y, type = "l") | ||
``` | ||
|
||
(e) | ||
```{r 2e} | ||
x <- seq(0, 20, length.out = 500) | ||
y <- data.frame( | ||
y1 = sqrt(x), | ||
y2 = 2.5 + sqrt(x) | ||
) | ||
matplot(x, y, type = "l", col = c("blue", "red"), lty = 1) | ||
``` | ||
|
||
|
||
## Answer 3 | ||
|
||
![Answer 3(a)](2a3a.jpg){width=350px} | ||
![Answer 3(b)](2a3b.jpg){width=350px} | ||
|
||
## Research homework assignment | ||
Research homework assignment | ||
|
||
Suppose that $X$ and $Y$ are independent (real) random variables admitting | ||
densities $f_X$ and $f_Y$, and let $Z = X/Y$. | ||
We will say that $Z$ has Cauchy tails when $f_Z (z) \sim C/z^2$ as $|z| \to | ||
\infty$ for some $C > 0$. | ||
|
||
**Proposition 1:** Suppose that $\mathbb{E}[|X|] < \infty$, and that $f_Y$ is bounded. | ||
If $f_Y$ is continuous at $0$ with $f_Y(0) > 0$, then $Z = X/Y$ has Cauchy tails with $$ | ||
f_Z(z) \sim \frac{f_Y(0) \:\mathbb{E}[|X|]}{z^2} \quad\text{as } |z| \to \infty. | ||
$$ | ||
_Proof:_ Observe that the density $f_Z$ of $Z$ is given by $$ | ||
f_Z (z) = \int_\mathbb{R} |y| f_X(z y) f_Y(y) \:dy | ||
= \frac{1}{z^2} \int_\mathbb{R} |x| f_X(x) f_Y\left(\frac{x}{z}\right) \:dx. | ||
$$ | ||
This can be seen by applying change of variables on $(X, Y)$ using the map | ||
$(x, y) \mapsto (x/y, y)$, whose inverse is $(z, y) \mapsto (z y, y)$, and computing | ||
the marginal. | ||
Let $f_Y < M$, so $$ | ||
|x| f_X(x) f_Y\left(\frac{x}{z}\right) < |x| f_X(x) M \in L^1(\mathbb{R}) | ||
$$ via $\mathbb{E}[|X|] < \infty$. | ||
By the Dominated Convergence Theorem, we have $$ | ||
\lim_{z \to \infty} z^2 f_Z(z) | ||
= \lim_{z \to \infty} \int_\mathbb{R} |x| f_X(x) f_Y\left(\frac{x}{z}\right) \:dx | ||
= \int_\mathbb{R} |x| f_X (x) f_Y(0) \:dx | ||
= f_Y(0) \:\mathbb{E}[|X|]. \tag*{$\square$} | ||
$$ | ||
_Remark:_ In the special case that $X, Y \sim N(0, 1)$, we have $X/Y \sim \text{Cauchy}(0, 1)$. | ||
Note that Proposition 1 does not cover situations such as $Y \sim \text{Uniform}(0, 1)$. | ||
The continuity assumption on $f_Y$ can be relaxed slightly by dealing with the left and right tails of $Z$ separately. | ||
**Proposition 2:** Suppose that $\mathbb{E}[|X|] < \infty$, and that $f_Y$ is bounded. | ||
If $f_Y$ has both left and right limits at $0$, then $Z = X/Y$ has a Cauchy right tail with $$ | ||
f_Z(z) \sim \frac{f_Y(0^-) \:\mathbb{E}[X^-] + f_Y(0^+)\:\mathbb{E}[X^+]}{z^2} \quad\text{as } z \to +\infty, | ||
$$ | ||
and a Cauchy left tail with $$ | ||
f_Z(z) \sim \frac{f_Y(0^+) \:\mathbb{E}[X^-] + f_Y(0^-)\:\mathbb{E}[X^+]}{z^2} \quad\text{as } z \to -\infty. | ||
$$ | ||
_Proof:_ Following the same argument as in Proposition 1, we use the Dominated Convergence Theorem on $$ | ||
z^2 f_Z(z) | ||
= \int_{-\infty}^0 |x| f_X(x) f_Y\left(\frac{x}{z}\right) \:dx | ||
+ \int_0^{+\infty} |x| f_X(x) f_Y\left(\frac{x}{z}\right) \:dx. \tag*{$\square$} | ||
$$ | ||
_Remark:_ Note that $Z = (1/Y) / (1/X)$, so Proposition 2 has an analogue which demands $\mathbb{E}[1/|Y|] < \infty$ and that the density of $1/X$ have both left and right limits at $0$. |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
--- | ||
title: "Assignment 2b" | ||
author: "Satvik Saha" | ||
date: "`r Sys.Date()`" | ||
output: | ||
pdf_document: default | ||
--- | ||
|
||
```{r setup, include=FALSE} | ||
knitr::opts_chunk$set(echo = TRUE) | ||
``` | ||
|
||
## Answer 1 | ||
|
||
```{r 1} | ||
v1 <- rep(1, 10) | ||
v2 <- 1:10 | ||
v3 <- v2^2 | ||
X <- rbind(v1, v2, v3) | ||
``` | ||
|
||
(a) For equal weights, the weighted average is just the usual simple average. | ||
```{r 1a} | ||
colMeans(X) | ||
``` | ||
|
||
(b) | ||
```{r 1b} | ||
w <- c(1, 2, 3) | ||
colSums(X * w) / sum(w) | ||
``` | ||
|
||
|
||
## Answer 2 | ||
|
||
(a) Number of games won by a chess player who has played 20 games, with a probability of 30% of winning each game. | ||
```{r 2a} | ||
rbinom(1, 20, 0.3) | ||
``` | ||
|
||
(b) Number of games won by a couple of chess players who have played 20 games (not against each other). The first has a probability of 30% of winning each game, while the second has a probability of 40% of winning each game. | ||
```{r 2b} | ||
rbinom(2, 20, c(0.3, 0.4)) | ||
``` | ||
|
||
(c) Number of games won by a couple of chess players. The first has played 30 games with a probability of 30% of winning each game, while the second has played 20 games with a probability of 40% of winning each game. | ||
```{r 2c} | ||
rbinom(2, c(30, 20), c(0.3, 0.4)) | ||
``` |
Binary file not shown.
Oops, something went wrong.