-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhw4.tex
77 lines (64 loc) · 3.24 KB
/
hw4.tex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
\documentclass{article}
\usepackage{amsmath, amsthm, amssymb}
\usepackage{listings}
\usepackage{graphicx}
\usepackage{float}
\usepackage{enumerate}
\usepackage{fancyhdr}
\usepackage[labelfont=bf]{caption}
\usepackage[left=0.75in, top=1in, right=0.75in, bottom=1in]{geometry}
\pagestyle{plain}
\begin{document}
\rhead{Aaron Okano, Anatoly Torchinsky, Samuel Huang, Justin Maple \\
ECS 132: Homework 4}
\thispagestyle{fancy}
% Let the homework begin!
\section*{Problem 1}
\subsection*{(a)}
First we obtained the $\chi^{2}$ proportion $P(s^{2} < 4.8)$ by using \verb+pchisq(9*4.8/4,df=9)+, which gave us a value of 0.7103325. Then we used normal distribution to simulate $P( s^{2} < 4.8 )$ . First, we sampled $n$ variates of the normal distribution with $\sigma = 2$ and found the following variance $s^{2}$:
\begin{align*}
s^2 &= \frac{1}{n} \displaystyle\sum\limits_{i=1}^n (X_{i}- \bar{X})^{2} \\
\end{align*}
Then, we repeated the first process and found the proportion of variances that were less than 4.8. This proportion turned out to be around .76, which was close to the value we obtained using the $\chi^{2}$ proportion.
\subsection*{(b)}
Similar to our variate sampling in part a, except using an exponential distribution. We found the proportion of variances calculated to be $\approx 1$.
\section*{Problem 2}
Let us begin by finding the variances of the two variables. First, note that
the probability of choosing someone with the trait in the entire population is
$P(T) = P(Sub_1,T\cup Sub_2,T) = qp_1 + ( 1 - q )p_2$, where $p_i$ is the
probability of finding the trait in the $i^{th}$ population, $T$ is an indicator
variable for the trait, and $Sub_i$ is an indicator for whether we are in
subpopulation $i$ or not. Because $X$ consists of indicator random variables,
we can easily find variance.
\begin{align*}
Var(X) &= \frac{1}{n}\sigma^2 \\
&= \frac{1}{n}p(1-p) \\
&= \frac{1}{n}\left\{[qp_1 + (1-q)p_2][1 - qp_1 - (1-q)p_2]\right\}
\end{align*}
Now to find $Var(Y)$, let $S_1$ be the sampled number of people with the trait
in population 1 and let $S_2$ be the sampled number of people with the trait in
population 2.
\begin{align*}
Var(Y) &= Var(S_1 + S_2) \\
&= \frac{1}{n^2}\sum\limits_{i = 1}^{n} Var( Y_i ) \\
&= \frac{1}{n^2}\left[qnVar( S_1 ) + (1-q)nVar( S_2 ) \right] \\
&= \frac{1}{n} [qVar( S_1 ) + (1-q)Var(S_2)] \\
&= \frac{1}{n} [qp_1(1-p_1) + (1-q)p_2(1-p_2)]
\end{align*}
We can also make the observation that, in the case of the problem at hand, $q =
(1-q)$ and $p_1 = (1 - p_2)$. Finding $Var(Y)/Var(X)$ is a matter of algebra at
this point.
\begin{align*}
Var(Y)/Var(X) &= \frac{qp_1(1-p_1)+(1-q)p_2(1-p_2)}{[qp_1+(1-q)p_2]
[1-qp_1-(1-q)p_2]} \\
&= \frac{qp_1p_2 + qp_2p_1}{[qp_1+q(1-p_1)][1-qp_1+q(1-p_1)]} \\
&= \frac{2qp_1p_2}{q(1-q)} \\
&= \frac{2p_1p_2}{q}
\end{align*}
Plugging in our values for $p_1$, $p_2$, and $q$, we get
\begin{equation*}
Var(Y)/Var(X) = 0.75
\end{equation*}
\section*{Problem 3}
First we sampled each of the $X,Y,Z$ proportions 15 times with probabilities $p1=0.11, p2=0.16, p3=0.05$ respectively. We then found whether $Z > 2XY$ for a number of iterations, and found that the proportion of times that the array has \verb+TRUE+ values is $\approx 0.46$.
\end{document}