5th semester files
This commit is contained in:
Binary file not shown.
Binary file not shown.
@ -0,0 +1,113 @@
|
||||
# Homework 2 - Aidan Sharpe
|
||||
## 1
|
||||
Consider two **disjoint** events V and W and suppose we know the probabilities $P(V)$ and $P(W)$. What is a simple expression for $P(V \cap W^c)$, using only the information given? You may obtain the answer by drawing a Venn diagram or listing intermediate equations.
|
||||
|
||||
$$P(W^c) = 1 - P(W)$$
|
||||
If $V$ and $W$ are disjoint, then $V$ and $W^c$ must be joint. For joint probabilities:
|
||||
$$P(A \cap B) = P(A)P(B)$$
|
||||
Combining the above:
|
||||
$$P(V \cap W^c) = P(V)[1-P(W)]$$
|
||||
|
||||
|
||||
## 2
|
||||
Consider a portion of an electric circuit that includes three independent components, each of which can either be open or closed. In order for current to flow from point A to point B, at least one of these components must be closed. Each component has a probability of 0.85 of functioning properly and closing when activated.
|
||||
|
||||
### a)
|
||||
What is the probability that the current will flow from point A to point B?
|
||||
|
||||
Let $R_1$ be the event that relay 1 works, $R_2$ be the event that relay 2 works, $R_3$ be the event that relay 3 works, and $C$ be the event that current flows.
|
||||
$$P(C) = P(R_1 \cup R_2 \cup R_3)$$
|
||||
$$P(C) = P(R_1) + P(R_2) + P(R_3) - P(R_1 \cap R_2) - P(R_1 \cap R_3) - P(R_2 \cap R_3) + P(R_1 \cap R_2 \cap R_3)$$
|
||||
$$P(R_1) = P(R_2) = P(R_3) = 0.85$$
|
||||
$$P(R_1 \cap R_2) = P(R_1 \cap R_3) = P(R_2 \cap R_3) = 0.722$$
|
||||
$$P(R_1 \cap R_2 \cap R_3) = 0.614$$
|
||||
|
||||
Plugging in yields:
|
||||
$$P(C) = 0.9966$$
|
||||
|
||||
### b)
|
||||
What is the probability that relay 2 functioned, given that the current flowed from point A
|
||||
to point B?
|
||||
$$P(R_2 | C) = \frac{P(C|R_2)P(R_2)}{P(C)}$$
|
||||
Since current will always flow if relay 2 works:
|
||||
$$P(C|R_2) = 1$$
|
||||
$$\therefore P(R_2 | C) = \frac{P(R_2)}{P(C)} = 0.853$$
|
||||
|
||||
## 3
|
||||
Selena uses one of her four cars to drive to work everyday. She drives one and only one car to work each day.
|
||||
$$P(C_1) = 0.4$$
|
||||
$$P(C_2) = 0.3$$
|
||||
$$P(C_3) = 0.15$$
|
||||
$$P(C_4) = 0.15$$
|
||||
|
||||
Let $X$ be the event that Selena will arrive to work on time. Depending on the car used, the probability of $X$ varies.
|
||||
$$P(X|C_1) = 0.85$$
|
||||
$$P(X|C_2) = 0.9$$
|
||||
$$P(X|C_3) = 0.8$$
|
||||
$$P(X|C_4) = 0.8$$
|
||||
|
||||
### a)
|
||||
Find $P(C_2 \cup C_3)$:
|
||||
|
||||
Since $C_2$ and $C_3$ are disjoint events:
|
||||
$$P(C_2 \cup C_3) = P(C_2) + P(C_3) = 0.45$$
|
||||
|
||||
### b)
|
||||
$$P(C_1|X) = \frac{P(X|C_1)P(C_1)}{P(X)}$$
|
||||
$$P(X) = P((X|C_1) \cup (X|C_2) \cup (X|C_3) \cup (X|C_4)) = 0.85$$
|
||||
$$P(C_1|X) = \frac{0.85 \times 0.4}{0.85} = 0.4$$
|
||||
|
||||
## 4
|
||||
Suppose you are given four copies of the novel *Burns: The Expertise of Achievement*, which has become a very popular read amongst America’s urban youth. The four copies are known to contain two defectives. Your job is to test the books one at a time until the two defective books are found. Once you locate the two defective copies, you will stop testing. Let $X$ denote the number of the test on which the second defective copy of the book is found. Find the probability distribution for $X$.
|
||||
$$P(X=2) = \frac{1}{6}$$
|
||||
$$P(X=3) = \frac{1}{3}$$
|
||||
$$P(X=4) = \frac{1}{2}$$
|
||||
|
||||
## 5
|
||||
The probability distribution of $X$, the number of imperfections per 10 meters of a synthetic fabric in continuous rolls of uniform width, is given by:
|
||||
|$x$|$f(x)$
|
||||
|-|-
|
||||
|$0$|$0.41$
|
||||
|$1$|$0.37$
|
||||
|$2$|$0.16$
|
||||
|$3$|$0.05$
|
||||
|$4$|$0.01$
|
||||
|
||||
### a)
|
||||
What is the probability that there are 3 imperfections?
|
||||
$$P(X=3) = 0.05$$
|
||||
|
||||
### b)
|
||||
What is the probability that there is at least one but no more than three imperfections?
|
||||
$$P(X=1 \cup X=2 \cup X=3) = 0.37+0.16+0.05 = 0.58$$
|
||||
|
||||
## 6
|
||||
Software to detect fraud in consumer phone cards tracks the number of metropolitan areas where calls originate each day. It is found that 1% of the legitimate users originate calls from two or more metropolitan areas in a single day. However, 30% of fraudulent users originate calls from two or more metropolitan areas in a single day. The proportion of fraudulent users is 0.01%. If the same user originates calls from two or more metropolitan areas in a single day, what is the probability that the user is fraudulent?
|
||||
|
||||
$F$ is the event that a user is fraudulent, $F^c$ is the event that a user is not fraudulent. $M$ is the event that a user originates calls from two or more metropolitan areas in a single day.
|
||||
|
||||
$$P(F) = 0.0001$$
|
||||
$$P(F^c) = 0.9999$$
|
||||
$$P(M|F) = 0.3$$
|
||||
$$P(M|F^c) = 0.01$$
|
||||
$$P(M) = 0.3 \times 0.0001 + 0.01 \times 0.9999 = 0.01003$$
|
||||
$$P(F|M) = \frac{P(M|F) P(F)}{P(M)} = \frac{0.3 \times 0.0001}{0.01003} = 0.00299$$
|
||||
|
||||
## 7
|
||||
An assembly consists of three mechanical components. Suppose that the probabilities that the first, second, and third components meet specifications are 0.95, 0.98, and 0.99. Assume that the components are independent. Determine the probability mass function of the number of components in the assembly that meet specifications.
|
||||
|
||||
Let $C_1$ be the event that the first component meets specification, $C_2$ be the event that the second component meets specification, $C_3$ be the event that the third component meets specification, and $X$ be the number of components that meet specification:
|
||||
$$P(X=0) = P(C_1 \cap C_2 \cap C_3)= 0.95\times0.98\times0.99 = 0.9217$$
|
||||
$$P(X=1) = P((C_1 \cap C_2 \cap C_3^c) \cup (C_1 \cap C_3 \cap C_2^c) \cup (C_2 \cap C_3 \cap C_1^c))$$
|
||||
$$P(X=1)= 0.0766$$
|
||||
$$P(X=2) = P((C_1 \cap C_2^c \cap C_3^c) \cup (C_2 \cap C_1^c \cap C_3^c) \cup (C_3 \cap C_2^c \cap C_1^c))$$
|
||||
$$P(X=2) = 0.00167$$
|
||||
$$P(X=3) = P(C_1^c \cap C_2^c \cap C_3^c) = 0.05\times 0.02 \times 0.01 = 0.00001$$
|
||||
|
||||
$$p_X(x) =
|
||||
\begin{cases}
|
||||
0.921689 & x=0 \\
|
||||
0.07663 & x=1 \\
|
||||
0.00167 & x=2 \\
|
||||
0.00001 & x=3
|
||||
\end{cases}$$
|
Binary file not shown.
@ -0,0 +1,154 @@
|
||||
# Homework 3 - Aidan Sharpe
|
||||
## 1
|
||||
$$F(x) = \begin{cases}
|
||||
0 & x < 0 \\
|
||||
1 - e^{-7x} & x \ge 0
|
||||
\end{cases}$$
|
||||
|
||||
### a)
|
||||
Find the probability density function of $X$:
|
||||
$$f(x) = {d\over dx} F(x) = \begin{cases}
|
||||
0 & x < 0 \\
|
||||
7e^{-7x} & x \ge 0
|
||||
\end{cases}
|
||||
$$
|
||||
|
||||
### b)
|
||||
Verify that $f(x)$ is a valid density function:
|
||||
$$\int\limits_0^\infty f(x)dx \overset{?}{=} 1$$
|
||||
$$\int\limits_0^\infty 7e^{-7x}dx = \left[-e^{-7x}\Big|_0^\infty\right] = 0 - (-1) = 1$$
|
||||
|
||||
### c)
|
||||
Find $P(X<0.25)$:
|
||||
|
||||
$$F(0.25) = 1-e^{-7(0.25)} = 0.826$$
|
||||
|
||||
### d)
|
||||
Find $P({5\over60} < X < {11\over60})$:
|
||||
$$F\left({11\over60}\right) = 0.723$$
|
||||
$$F\left({5\over60}\right) = 0.442$$
|
||||
$$P\left({5\over60} < X < {11\over60}\right) = 0.723 - 0.442 = 0.281$$
|
||||
|
||||
## 2
|
||||
$$f(x) = \begin{cases}
|
||||
kx^{-3} & x > 1 \\
|
||||
0 & \text{elsewhere}
|
||||
\end{cases}$$
|
||||
|
||||
### a)
|
||||
Find $k$, such that $f(x)$ is a valid density function:
|
||||
$$\int\limits_0^\infty f(x)dx \overset{!}{=} 1$$
|
||||
$$\int\limits_1^\infty kx^{-3}dx = \left[{-k\over 2x^2}\Big|_1^\infty\right] = 0 - {-k\over2}$$
|
||||
$$\therefore k = 2$$
|
||||
|
||||
### b)
|
||||
Find $F(x)$:
|
||||
$$F(x) = \int\limits_{-\infty}^x f(t)dt$$
|
||||
$$F(x) = \begin{cases}
|
||||
1-{1\over x^2} & x > 1 \\
|
||||
0 & \text{elsewhere}
|
||||
\end{cases}$$
|
||||
|
||||
### c)
|
||||
Find $P(X>7)$:
|
||||
$$P(X>7) = F(7) = 0.98$$
|
||||
|
||||
### d)
|
||||
Find $P(5 < X < 12)$:
|
||||
$$P(X < 12) = F(12) = 0.993$$
|
||||
$$P(X < 5) = 0.96$$
|
||||
$$P(5 < X < 12) = F(12) - F(5) = 0.033$$
|
||||
|
||||
## 3
|
||||
$$f(x) = \begin{cases}
|
||||
{1\over5} & 1 < x < 6 \\
|
||||
0 & \text{elsewhere}
|
||||
\end{cases}$$
|
||||
|
||||
### a)
|
||||
Verify that $f(x)$ is a valid probability density function:
|
||||
$$\int\limits_0^\infty f(x)dx \overset{?}{=} 1$$
|
||||
$${1\over5}(6 - 1) = 1$$
|
||||
|
||||
### b)
|
||||
Find $P(2.5 \le X < 3)$:
|
||||
$$P(2.5 \le X < 3) = F(3) - F(2.5) = 0.4 - 0.3 = 0.1$$
|
||||
|
||||
### c)
|
||||
Find $P(X \le 2)$:
|
||||
$$P(X \le 2) = F(2) = 0.4$$
|
||||
|
||||
### d)
|
||||
Find $F(x)$:
|
||||
$$F(x) = \int\limits_{-\infty}^{x} f(t)dt$$
|
||||
$$F(x) = \begin{cases}
|
||||
0 & x < 1 \\
|
||||
{(x-1)\over5} & 1 \le x < 6 \\
|
||||
1 & x \ge 6
|
||||
\end{cases}$$
|
||||
|
||||
## 4
|
||||
A box contains 7 dimes and 5 nickels. Three coins are chosen. $T$ is their total value in cents.
|
||||
|
||||
### a)
|
||||
The set of all possible drawings of coins is:
|
||||
$$\{DDD, DDN, DND, DNN, NDD, NDN, NND, NNN\}$$
|
||||
|
||||
Therefore the following are values for $T$:
|
||||
$$T = \{30, 25, 20, 15\}$$
|
||||
|
||||
### b)
|
||||
Find the probability density function for $T$, $f(x)$:
|
||||
$$P(T = 30) = {{7\choose3}{5\choose0}\over{12\choose3}} = 0.159$$
|
||||
$$P(T = 25) = {{7\choose2}{5\choose1}\over{12\choose3}} = 0.477$$
|
||||
$$P(T = 20) = {{7\choose1}{5\choose2}\over{12\choose3}} = 0.318$$
|
||||
$$P(T = 15) = {{7\choose0}{5\choose3}\over{12\choose3}} = 0.046$$
|
||||
|
||||
$$f(x) = \begin{cases}
|
||||
0.046 & x = 15 \\
|
||||
0.318 & x = 20 \\
|
||||
0.477 & x = 25 \\
|
||||
0.159 & x = 30 \\
|
||||
\end{cases}$$
|
||||
|
||||
### c)
|
||||
Find the CDF for $T$, $F(x)$:
|
||||
$$f(x) = \begin{cases}
|
||||
0 & x < 15 \\
|
||||
0.046 & 15 \le x < 20 \\
|
||||
0.364 & 20 \le x < 25\\
|
||||
0.841 & 25 \le x < 30 \\
|
||||
1 & x \ge 30 \\
|
||||
\end{cases}$$
|
||||
|
||||
## 5
|
||||
|$x$|$f(x)$|
|
||||
|-|-
|
||||
|10|0.08
|
||||
|11|0.15
|
||||
|12|0.30
|
||||
|13|0.20
|
||||
|14|0.20
|
||||
|15|0.07
|
||||
|
||||
Determine the mean number of messages sent per hour
|
||||
$$\sum\limits_x xf(x) = 10(0.08) + 11(0.15) + 12(0.30) + 13(0.20) + 14(0.20) + 15(0.07) = 12.5$$
|
||||
|
||||
## 6
|
||||
Find the expected value for each of the following probability density functions:
|
||||
|
||||
### a)
|
||||
$$f(x) = \begin{cases}
|
||||
x + {1\over2} & 0 < x < 1 \\
|
||||
0 & \text{elsewhere}
|
||||
\end{cases}$$
|
||||
|
||||
$$E[x]=\int\limits_0^1 \left(x+{1\over2}\right)dx = \left[ {x^2 + x \over 2} \Big|_0^1 \right] =1$$
|
||||
|
||||
### b)
|
||||
$$f(x) = \begin{cases}
|
||||
{3\over x^4} & x \ge 1 \\
|
||||
0 & \text{elsewhere}
|
||||
\end{cases}$$
|
||||
|
||||
$$E[x] \int\limits_1^\infty {3\over x^4}dx = \left[ {-1 \over x^3} \Big|_1^\infty \right] = 0 - (-1) = 1$$
|
Binary file not shown.
@ -0,0 +1,208 @@
|
||||
# Homework 5 - Aidan Sharpe
|
||||
|
||||
## 1
|
||||
The finished inside diameter of a piston ring is normally distributed with a mean, $\mu = 10$[cm], and a standard deviation, $\sigma = 0.03$[cm].
|
||||
|
||||
### a)
|
||||
What is the probability that the inside diameter exceeds 10.04[cm]?
|
||||
$$Z = {10.04 - 10 \over 0.03} = {4 \over 3}$$
|
||||
```ipython
|
||||
>>> from scipy.stats import norm
|
||||
>>> z = (10.04 - 10) / 0.03
|
||||
>>> 1 - norm.cdf(z)
|
||||
0.09121121972587254
|
||||
```
|
||||
$$P(X > 10.04) = 0.0912$$
|
||||
|
||||
|
||||
### b)
|
||||
What is the probability that a piston ring will have an inside diameter between 9.98[cm] and 10.02[cm]?
|
||||
$$Z_1 = {9.98 - 10 \over 0.03}$$
|
||||
$$Z_2 = {10.02 - 10 \over 0.03}$$
|
||||
```python
|
||||
>>> from scipy.stats import norm
|
||||
>>> z1 = (9.98 - 10) / 0.03
|
||||
>>> z2 = (10.02 - 10) / 0.03
|
||||
>>> norm.cdf(z2) - norm.cdf(z1)
|
||||
0.49501492490614524
|
||||
```
|
||||
$$P(9.98 < X < 10.02) = 0.4950$$
|
||||
|
||||
### c)
|
||||
What is the probability that a piston ring will have an inside diameter of less than 10[cm]?
|
||||
|
||||
By the definition of a normal distribution:
|
||||
$$P(X < \mu) = 0.5$$
|
||||
|
||||
## 2
|
||||
A research engineer for a tire manufacturer is investigating tire life for a new rubber compound and has built 20 tires and tested them to end-of-life in a road test. The sample mean is $\bar{x} = 60139.7$[km] and the standard deviation, $\sigma = 3645.94$[km]. Calculate a 99% confidence interval for the mean life of all such tires.
|
||||
|
||||
For a 99% confidence interval, $\alpha = 0.01$, and the interval is given by:
|
||||
$$\bar{x} \pm z_{\alpha \over 2} {\sigma \over \sqrt{n}}$$
|
||||
```python
|
||||
>>> from scipy.stats import norm
|
||||
>>> a = 0.01
|
||||
>>> z_a2 = norm.ppf(1 - (a/2))
|
||||
>>> x_bar = 60139.7
|
||||
>>> stddev = 3645.94
|
||||
>>> x_bar + z_a2 * stddev / n**(1/2)
|
||||
62239.66278858252
|
||||
>>> x_bar - z_a2 * stddev / n**(1/2)
|
||||
58039.73721141747
|
||||
```
|
||||
We are 99% certain that the mean life of a tire made with this rubber compound is between 62239.7[km] and 58039.7[km].
|
||||
|
||||
## 3
|
||||
A sample of $n = 25$ joint specimens of a particular type gave a sample mean proportional limit stress of $\bar{x} = 8.6$[MPa] and a sample standard deviation of $s = 0.81$[MPa]. Construct and interpret in context a 95% confidence interval for the true average proportional limit stress of all such joints. Note that the population standard deviation is not known here. Be sure to use the correct confidence interval formulation.
|
||||
|
||||
For a 95% confidence interval, $\alpha = 0.05$, and the interval is given by:
|
||||
$$\bar{x} \pm t^* {s \over \sqrt{n}}$$
|
||||
|
||||
```python
|
||||
>>> from scipy.stats import t
|
||||
>>> n = 25
|
||||
>>> x_bar = 8.6E6
|
||||
>>> s = 0.81E6
|
||||
>>> a = 0.05
|
||||
>>> t_star = t.ppf(1 - (a/2), n)
|
||||
>>> x_bar + t_star * s / n**(1/2)
|
||||
8933645.245546034
|
||||
>>> x_bar - t_star * s / n**(1/2)
|
||||
8266354.754453966
|
||||
```
|
||||
|
||||
We are 95% confident that the mean proportional limit stress for this type of joint specimen is between 8.2[MPa] and 8.9[MPa].
|
||||
|
||||
## 4
|
||||
A sample of 45 pieces of laminate used in the manufacture of circuit boards was selected and the amount of warpage, in inches, under particular conditions was determined for each piece, resulting in a sample mean warpage of $\bar{x} = 0.0631$[in] and a sample standard deviation of $s = 0.0072$[in].
|
||||
|
||||
### a)
|
||||
Construct and interpret in context a 99% confidence interval for the average amount of warpage in all such pieces of laminate.
|
||||
```python
|
||||
>>> from scipy.stats import t
|
||||
>>> x_bar = 0.0631
|
||||
>>> s = 0.0072
|
||||
>>> a = 0.01
|
||||
>>> n = 45
|
||||
>>> t_star = t.ppf(1-a/2, n)
|
||||
>>> x_bar + t_star * s / n**(1/2)
|
||||
0.06598676556860165
|
||||
>>> x_bar - t_star * s / n**(1/2)
|
||||
0.06021323443139835
|
||||
```
|
||||
|
||||
We are 99% certain that the average amount of warpage in all pieces of this type of laminate is between 0.0602 inches and 0.0660 inches.
|
||||
|
||||
### b)
|
||||
Construct and interpret in context a 90% confidence interval for the average amount of warpage in all such pieces of laminate.
|
||||
|
||||
```python
|
||||
>>> from scipy.stats import t
|
||||
>>> x_bar = 0.0631
|
||||
>>> s = 0.0072
|
||||
>>> n = 45
|
||||
>>> a = 0.1
|
||||
>>> t_star = t.ppf(1-a/2, n)
|
||||
>>> x_bar + t_star * s / n**(1/2)
|
||||
0.06490255062920108
|
||||
>>> x_bar - t_star * s / n**(1/2)
|
||||
0.06129744937079893
|
||||
```
|
||||
We are 90% certain that the average amount of warpage in all pieces of this type of laminate is between 0.0613 inches and 0.0649 inches.
|
||||
|
||||
### c)
|
||||
Which interval is wider and why?
|
||||
|
||||
The only ways to increase confidence are by increasing sample size and by increasing the width of the confidence interval. A smaller confidence interval inherintly has a larger uncertainty associated with it. For this reason, the 90% confidence interval is smaller than the 99% confidence interval.
|
||||
## 5
|
||||
For this problem, use the code labeled problem 6 in the file ”hw 5 code” on Canvas. You will explore the width of a confidence interval as the sample size increases. Suppose we are interested in estimating some population parameter $\mu$. We will fix the population parameter to be $\mu = 75$. Of course, in practice we would not know $\mu$, otherwise we would not need to estimate it. Assume the population standard deviation is $\sigma = 13$.
|
||||
|
||||
**To find the width of an interval, subtract the lower bound from the upper bound**
|
||||
```python
|
||||
>>> from scipy.stats import norm
|
||||
>>> import numpy as np
|
||||
>>> def sample_mean(sample_size):
|
||||
... sample = np.random.chisquare(df=75, size=samplesize)
|
||||
... return np.mean(sample)
|
||||
```
|
||||
|
||||
### a)
|
||||
Let $n=10$. Run `sample_mean(10)` and record the value of $\bar{x}$. Use $\bar{x}$ to construct a 95% confidence interval for $\mu$.
|
||||
```python
|
||||
>>> n = 10
|
||||
>>> x_bar = sample_mean(n)
|
||||
>>> x_bar # Print out the sample mean for n=10
|
||||
73.32164347142393
|
||||
>>> a = 0.05
|
||||
>>> stddev = 13
|
||||
>>> z_a2 = norm.ppf(1 - a/2)
|
||||
>>> x_bar + z_a2 * stddev / n**(1/2) # Find the upper bound for the CI
|
||||
81.37897889138323
|
||||
>>> x_bar - z_a2 * stddev / n**(1/2) # Find the lower bound for the CI
|
||||
65.26430805146462
|
||||
```
|
||||
The 95% confidence interval for $n=10$ is (65.26, 81.38).
|
||||
|
||||
### b)
|
||||
Do the same for $n=50$.
|
||||
```python
|
||||
>>> n = 50
|
||||
>>> x_bar = sample_mean(n)
|
||||
>>> x_bar # Print out the sample mean for n=50
|
||||
76.17226231360712
|
||||
>>> a = 0.05
|
||||
>>> stddev = 13
|
||||
>>> z_a2 = norm.ppf(1 - a/2)
|
||||
>>> x_bar + z_a2 * stddev / n**(1/2) # Find the upper bound for the CI
|
||||
79.77561225691628
|
||||
>>> x_bar - z_a2 * stddev / n**(1/2) # Find the lower bound for the CI
|
||||
72.56891237029797
|
||||
```
|
||||
The 95% confidence interval for $n=50$ is (72.57, 79.78).
|
||||
|
||||
### c)
|
||||
Do the same for $n=500$.
|
||||
```python
|
||||
>>> n=500
|
||||
>>> x_bar = sample_mean(n)
|
||||
>>> x_bar # Print out the sample mean for n=500
|
||||
74.93800434978642
|
||||
>>> x_bar + z_a2 * stddev / n**(1/2) # Find the upper bound for the CI
|
||||
76.07748365253597
|
||||
>>> x_bar - z_a2 * stddev / n**(1/2) # Find the lower bound for the CI
|
||||
73.79852504703688
|
||||
```
|
||||
The 95% confidence interval for $n=500$ is (73.80, 76.08).
|
||||
|
||||
### d)
|
||||
Do the same for $n=5000$.
|
||||
```python
|
||||
>>> n=5000
|
||||
>>> x_bar = sample_mean(n)
|
||||
>>> x_bar # Print out the sample mean for n=5000
|
||||
74.92683635507494
|
||||
>>> x_bar + z_a2 * stddev / n**(1/2) # Find the upper bound for the CI
|
||||
75.28717134940585
|
||||
>>> x_bar - z_a2 * stddev / n**(1/2) # Find the lower bound for the CI
|
||||
74.56650136074403
|
||||
```
|
||||
The 95% confidence interval for $n=5000$ is (74.57, 75.29).
|
||||
|
||||
### e)
|
||||
Do the same for $n=50000$.
|
||||
```python
|
||||
>>> n=50000
|
||||
>>> x_bar = sample_mean(n)
|
||||
>>> x_bar # Print out the sample mean for n=50000
|
||||
75.03170012357572
|
||||
>>> x_bar + z_a2 * stddev / n**(1/2) # Find the upper bound for the CI
|
||||
75.14564805385068
|
||||
>>> x_bar - z_a2 * stddev / n**(1/2) # Find the lower bound for the CI
|
||||
74.91775219330076
|
||||
```
|
||||
The 95% confidence interval for $n=50000$ is (74.92, 75.15).
|
||||
|
||||
### f)
|
||||
What do you notice abou the width of the confidence interval as the sample size increases?
|
||||
|
||||
As the sample size increases, the width of the confidence interval decreases quickly at first, but quickly yields diminishing returns.
|
Binary file not shown.
@ -0,0 +1,143 @@
|
||||
# Homework 6 - Aidan Sharpe
|
||||
|
||||
## 1
|
||||
Using a mathematical model, social analysts estimate that, on average, a US adult has social ties with 634 people. A survey of 1700 randomly selected US adults who are cell phone users find that the average number of social ties for the cell phone users in the sample was 664 with a standard deviation of 500. Does the sample provide evidence that the average number of social ties for a cell phone user is significantly different from 634, the hypothesized number for all US adults? Use $\alpha = 0.05$.
|
||||
|
||||
$$\mu = 634$$
|
||||
$$\bar{x} = 664$$
|
||||
$$s = 500$$
|
||||
$$\alpha = 0.05$$
|
||||
|
||||
### a)
|
||||
$H_0$: $\mu = 634$
|
||||
|
||||
$H_a$: $\mu \ne 634$
|
||||
|
||||
### b)
|
||||
$$t^* = {664 - 634 \over {500 \over \sqrt{1700}}} = 2.47386$$
|
||||
|
||||
### c)
|
||||
```python
|
||||
>>> import numpy as np
|
||||
>>> import scipy.stats as st
|
||||
>>> import matplotlib.pyplot as plt
|
||||
|
||||
>>> def p_value(test_statistic, sample_size):
|
||||
... test_statistic = abs(test_statistic)
|
||||
... return 1 - st.t.cdf(test_statistic, sample_size - 1)
|
||||
|
||||
>>> n = 1700
|
||||
>>> ts = (664 - 634) / (500 / n**(1/2))
|
||||
>>> p_value(ts, n)
|
||||
0.0067315863612649185
|
||||
```
|
||||
|
||||
### d)
|
||||
Since $0.00673 < 0.05$, we have enough evidence to reject the proposition that the average number of social ties of a US adult is 634 people.
|
||||
|
||||
## 2
|
||||
The Edison Electric Institute has published figures on the number of kilowatt hours used annually by various home appliances. It is claimed that a vacuum cleaner uses an average of 40 kilowatt hours per year. If a random sample of 14 homes included in a planned study indicates that vacuum cleaners use an average of 36 kilowatt hours per year with a standard deviation of 10.5 kilowatt hours, does this suggest at the 0.05 level of significance that vacuum cleaners use, on average, less than 40 kilowatt hours annually? Since the sample size is small, we will assume the population of kilowatt hours to be normal.
|
||||
|
||||
$$\mu_0 = 40$$
|
||||
$$\bar{x} = 36$$
|
||||
$$s = 10.5$$
|
||||
$$n = 14$$
|
||||
$$\alpha = 0.05$$
|
||||
|
||||
Null and alternative hypothesis:
|
||||
|
||||
$H_0$: $\mu = 40$
|
||||
|
||||
$H_a$: $\mu < 40$
|
||||
|
||||
$$t^* = {36 - 40 \over {10.5 \over \sqrt{14}}} = -1.42539$$
|
||||
|
||||
Using the same p-value function from the previous exercise:
|
||||
```python
|
||||
>>> n = 14
|
||||
>>> ts = (36 - 40) / (10.5 / n**(1/2))
|
||||
>>> p_value(ts, n)
|
||||
0.08880497181576619
|
||||
```
|
||||
Since the p-value is greater than $\alpha$, we do not have enough evidence to reject the proposition that the average power consumption of a vacuum cleaner is 40 kilowatt hours per year.
|
||||
|
||||
## 3
|
||||
The brightness of a television picture tube can be evaluated by measuring the amount of current required to achieve a particular brightness level. A sample of 65 tubes results in $\bar{x} = 317.2$ and $s = 15.7$. Find (in microamps) a 99% confidence interval on mean current required.
|
||||
|
||||
$$s = 15.7$$
|
||||
$$\bar{x} = 317.2$$
|
||||
$$n = 65$$
|
||||
$$\alpha = 0.01$$
|
||||
|
||||
$$\bar{x} \pm t^*{s \over \sqrt{n}}$$
|
||||
```python
|
||||
>>> from scipy.stats import t
|
||||
>>> s = 15.7
|
||||
>>> x_bar = 317.2
|
||||
>>> n = 65
|
||||
>>> a = 0.01
|
||||
>>> ts = t.ppf(1 - (a/2), n)
|
||||
>>> x_bar + ts * s / n**(1/2)
|
||||
322.3674842907025
|
||||
>>> x_bar - ts * s / n**(1/2)
|
||||
312.03251570929746
|
||||
```
|
||||
We are 99% confident that the mean current draw to achieve this particular brightness is between 312.033[$\mu$A] and 322.367[$\mu$A].
|
||||
|
||||
## 4
|
||||
Consider the scenario in the previous problem. Suppose that the design engineer claims that this tube will require at least 300 microamps of current to produce the desired brightness level. Formulate and test an appropriate hypothesis to confirm this claim using $\alpha = 0.05$.
|
||||
$$\bar{x} = 317.2$$
|
||||
$$s = 15.7$$
|
||||
$$n = 65$$
|
||||
$$\alpha = 0.05$$
|
||||
$$\mu_0 = 300$$
|
||||
|
||||
$H_0$: $\mu = 300$
|
||||
|
||||
$H_a$: $\mu > 300$
|
||||
|
||||
$$t^* = {317.2 - 300 \over {15.7 \over \sqrt{65}}} = 4.341$$
|
||||
|
||||
```python
|
||||
>>> from scipy.stats import t
|
||||
>>> n = 15.7
|
||||
>>> x_bar = 317.2
|
||||
>>> mu0 = 300
|
||||
>>> s = 15.7
|
||||
>>> ts = (x_bar - mu0) / (s / n**(1/2))
|
||||
>>> t.sf(abs(ts), n)
|
||||
0.00026342753958306323
|
||||
```
|
||||
Since the p-value is less than $\alpha$, we can reject the null hypothesis, meaning that the average tube will draw at least 300[$\mu$A].
|
||||
|
||||
## 5
|
||||
A new steel plant has gone into production and markets a specific grade of steel. It is necessary to determine if the mean tensile strength of the new product differs significantly from the industry standard. A sample of 40 is taken from the new producer and yields a mean tensile strength value of $\bar{x} = 48950$ psi with a standard deviation of $s = 2700$ psi. Determine if the mean ultimate tensile strength of the new product differs significantly from the industry standard, $\mu = 50000$psi. Use $\alpha = 0.01$
|
||||
|
||||
$$n = 40$$
|
||||
$$s = 2700$$
|
||||
$$\bar{x} = 48950$$
|
||||
$$\mu_0 = 50000$$
|
||||
$$\alpha = 0.01$$
|
||||
|
||||
$H_0$: $\mu = 50000$
|
||||
|
||||
$H_a$: $\mu \ne 50000$
|
||||
|
||||
$$t^* = {48950 - 50000 \over {2700 \over \sqrt{40}}} = -2.4595$$
|
||||
```python
|
||||
>>> from scipy.stats import t
|
||||
>>> n = 40
|
||||
>>> s = 2700
|
||||
>>> x_bar = 48950
|
||||
>>> mu0 = 50000
|
||||
>>> a = 0.01
|
||||
>>> ts = (x_bar - mu0) / (s / n**(1/2))
|
||||
>>> t.sf(abs(ts), n)
|
||||
0.00916542992087841
|
||||
```
|
||||
Since the p-value is less than but very close to $\alpha$, there is technically enough evidence to reject the proposition that the tensile strength meets the industry standard, however, more testing should be done to ensure this.
|
||||
|
||||
## 6
|
||||
Would your conclusion from Problem 5 change if we used a significance level of $\alpha = 0.05$?
|
||||
|
||||
If $\alpha$ was instead 0.05, the p-value would be much lower than the threshold required, and therefore there is enough evidence to reject the proposition that the tensile strength of this steel meets the industry standard.
|
Binary file not shown.
@ -0,0 +1,2 @@
|
||||
\relax
|
||||
\gdef \@abspage@last{1}
|
@ -0,0 +1,76 @@
|
||||
This is pdfTeX, Version 3.141592653-2.6-1.40.24 (TeX Live 2022/CVE-2023-32700 patched) (preloaded format=pdflatex 2023.9.26) 11 NOV 2023 20:48
|
||||
entering extended mode
|
||||
\write18 enabled.
|
||||
%&-line parsing enabled.
|
||||
**/tmp/nvim.sharpe/MpyYyC/0
|
||||
(/tmp/nvim.sharpe/MpyYyC/0
|
||||
LaTeX2e <2022-06-01> patch level 5
|
||||
L3 programming layer <2022-12-17>
|
||||
(/usr/share/texlive/texmf-dist/tex/latex/base/report.cls
|
||||
Document Class: report 2021/10/04 v1.4n Standard LaTeX document class
|
||||
(/usr/share/texlive/texmf-dist/tex/latex/base/size10.clo
|
||||
File: size10.clo 2021/10/04 v1.4n Standard LaTeX file (size option)
|
||||
)
|
||||
\c@part=\count185
|
||||
\c@chapter=\count186
|
||||
\c@section=\count187
|
||||
\c@subsection=\count188
|
||||
\c@subsubsection=\count189
|
||||
\c@paragraph=\count190
|
||||
\c@subparagraph=\count191
|
||||
\c@figure=\count192
|
||||
\c@table=\count193
|
||||
\abovecaptionskip=\skip47
|
||||
\belowcaptionskip=\skip48
|
||||
\bibindent=\dimen140
|
||||
)
|
||||
(/usr/share/texlive/texmf-dist/tex/latex/l3backend/l3backend-pdftex.def
|
||||
File: l3backend-pdftex.def 2022-10-26 L3 backend support: PDF output (pdfTeX)
|
||||
\l__color_backend_stack_int=\count194
|
||||
\l__pdf_internal_box=\box51
|
||||
)
|
||||
(./Homework-07.aux)
|
||||
\openout1 = `Homework-07.aux'.
|
||||
|
||||
LaTeX Font Info: Checking defaults for OML/cmm/m/it on input line 3.
|
||||
LaTeX Font Info: ... okay on input line 3.
|
||||
LaTeX Font Info: Checking defaults for OMS/cmsy/m/n on input line 3.
|
||||
LaTeX Font Info: ... okay on input line 3.
|
||||
LaTeX Font Info: Checking defaults for OT1/cmr/m/n on input line 3.
|
||||
LaTeX Font Info: ... okay on input line 3.
|
||||
LaTeX Font Info: Checking defaults for T1/cmr/m/n on input line 3.
|
||||
LaTeX Font Info: ... okay on input line 3.
|
||||
LaTeX Font Info: Checking defaults for TS1/cmr/m/n on input line 3.
|
||||
LaTeX Font Info: ... okay on input line 3.
|
||||
LaTeX Font Info: Checking defaults for OMX/cmex/m/n on input line 3.
|
||||
LaTeX Font Info: ... okay on input line 3.
|
||||
LaTeX Font Info: Checking defaults for U/cmr/m/n on input line 3.
|
||||
LaTeX Font Info: ... okay on input line 3.
|
||||
LaTeX Font Info: External font `cmex10' loaded for size
|
||||
(Font) <7> on input line 7.
|
||||
LaTeX Font Info: External font `cmex10' loaded for size
|
||||
(Font) <5> on input line 7.
|
||||
[1
|
||||
|
||||
{/var/lib/texmf/fonts/map/pdftex/updmap/pdftex.map}]
|
||||
(./Homework-07.aux) )
|
||||
Here is how much of TeX's memory you used:
|
||||
451 strings out of 476182
|
||||
8509 string characters out of 5796581
|
||||
1852793 words of memory out of 6000000
|
||||
20838 multiletter control sequences out of 15000+600000
|
||||
513497 words of font info for 36 fonts, out of 8000000 for 9000
|
||||
1137 hyphenation exceptions out of 8191
|
||||
34i,5n,38p,945b,107s stack positions out of 10000i,1000n,20000p,200000b,200000s
|
||||
</usr/share/texlive/texmf-dist/fonts/type1/public/amsfonts
|
||||
/cm/cmbx12.pfb></usr/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cm
|
||||
mi10.pfb></usr/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmmi7.pf
|
||||
b></usr/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmr10.pfb></usr
|
||||
/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmr7.pfb>
|
||||
Output written on Homework-07.pdf (1 page, 59220 bytes).
|
||||
PDF statistics:
|
||||
33 PDF objects out of 1000 (max. 8388607)
|
||||
19 compressed objects within 1 object stream
|
||||
0 named destinations out of 1000 (max. 500000)
|
||||
1 words of extra memory for PDF output out of 10000 (max. 10000000)
|
||||
|
@ -0,0 +1,102 @@
|
||||
# Homework 7 - Aidan Sharpe
|
||||
|
||||
## Problem 1
|
||||
A photoconductor film is manufactured at a nominal thickness of 25 mils. The product engineer wishes to decrease the energy absorption of the film, and he believes this can be achieved by reducing the thickness of the film to 20 mils. Eight samples of each film thickness are manufactured in a pilot production process, and the film absorption (in microjules per square inch) is measured. For the 25-mil film the sample data result is $\bar{x}_1 = 1.17$ and $s_1 = 0.10$. While for the 20-mil film, the data yield $\bar{x}_2 = 1.07$ and $s_2 = 0.09$. Note that an increase in film speed would lower the value of the observation in microjules per square inch. Do the data support the claim that reducing the film thickness increases the mean speed of the film? Use $\alpha = 0.10$ and assume the two population variances are equal and the underlying population of film speed is normally distributed.
|
||||
|
||||
$H_0$: $\mu_1 = \mu_2$
|
||||
$H_a$: $\mu_1 \ne \mu_2$
|
||||
|
||||
```python
|
||||
>>> import scipy.stats as st
|
||||
>>> def p_value(test_statistic, sample_size_1, sample_size_2):
|
||||
... df = sample_size_1 + sample_size_2 - 2
|
||||
... test_statistic = abs(test_statistic)
|
||||
... return 1 - st.t.cdf(test_statistic, df)
|
||||
|
||||
>>> def tstat(x1, x2, sp, n1, n2):
|
||||
... return (x1 - x2) / (sp * (1/n1 + 1/n2)**0.5)
|
||||
|
||||
>>> def sp(x1, x2, s1, s2, n1, n2):
|
||||
... return (((n1-1)*(s1**2) + (n2-1)*(s2**2)) / (n1 + n2 - 2))**0.5
|
||||
|
||||
>>> s_p = sp(x1, x2, s1, s2, n1, n2)
|
||||
>>> t_star = tstat(x1, x2, s_p, n1, n2)
|
||||
>>> p_value(t_star, n1, n2)
|
||||
0.02704853389386974
|
||||
```
|
||||
Since the p-value is less than $\alpha$, we have enough evidence to reject the notion that changing the thickness of the film has no effect on its energy absorbtion.
|
||||
|
||||
## Problem 2
|
||||
A QC technician measures the quality for two lots of product. In the first lot, 20 units are tested and the average measurement is 75 with sample variance 210. In the second lot, 25 units are tested with an average measurement of 70 and sample variance of 130. Given that higher is better for this quality measurement, test the hypothesis that the quality of the second lot is lower that that of the first lot using $\alpha = 0.05$. You may assume the two lots come from populations with the same variance.
|
||||
|
||||
$H_0$: $\mu_a = \mu_b$
|
||||
$H_a$: $\mu_a \ne \mu_b$
|
||||
|
||||
```python
|
||||
>>> n1 = 20
|
||||
>>> n2 = 25
|
||||
>>> x1 = 75
|
||||
>>> x2 = 70
|
||||
>>> s1 = 210**0.5
|
||||
>>> s2 = 130**0.5
|
||||
>>> s_p = sp(x1, x2, s1, s2, n1, n2)
|
||||
>>> t_star = tstat(x1, x2, s_p, n1, n2)
|
||||
>>> p_value(t_star, n1, n2)
|
||||
0.10092241987763473
|
||||
```
|
||||
|
||||
Since the p-value is greater than $\alpha$, there is not enough evidence to suggest that there is a difference in quality between the two lots.
|
||||
|
||||
## Problem 3
|
||||
Ace Explosive Demolition is understandably concerned with burn times for the fuses that they use in their work. Their two suppliers of fuses both deliver their fuses on spools that contain 10,000 feet of fuse. Thirty-two fuses of 30 feet in length are prepared from each supplier’s pool. The fuses are then lit, and each fuse’s elapsed burn time is carefully measured. Supplier A’s sample average and sample variance are 30.62 and .384 seconds, respectively. Supplier B’s sample average and sample variance are 31.37 seconds and 0.185 seconds, respectively. Does the sample suggest that the mean burn time for supplier A is different than that for supplier B? use $\alpha = 0.05$
|
||||
|
||||
$H_0$: $\mu_a = \mu_b$
|
||||
$H_a$: $\mu_a \ne \mu_b$
|
||||
|
||||
```python
|
||||
>>> n1 = 32
|
||||
>>> n2 = 32
|
||||
>>> x1 = 30.62
|
||||
>>> x2 = 31.37
|
||||
>>> s1 = (0.384)**0.5
|
||||
>>> s2 = (0.185)**0.5
|
||||
>>> s_p = sp(x1, x2, s1, s2, n1, n2)
|
||||
>>> t_star = tstat(x1, x2, s_p, n1, n2)
|
||||
>>> p_value(t_star, n1, n2)
|
||||
2.3757646183675263e-07
|
||||
```
|
||||
|
||||
Since the p-value is very close to zero, much smaller than $\alpha$, sample evidence suggests that the mean burn time for supplier A is not different than that for supplier B.
|
||||
|
||||
## Problem 4
|
||||
Consider the scenario stated in Problem 3. If $H_0$ is true and we conduct 7150 tests using 7150 different samples, how many (if any) of the individual tests would you expect to show a significant result just by random chance
|
||||
|
||||
Adjusting $n_1$ and $n_2$:
|
||||
|
||||
```python
|
||||
>>> n1 = 7150
|
||||
>>> n2 = 7150
|
||||
>>> s_p = sp(x1, x2, s1, s2, n1, n2)
|
||||
>>> s_p
|
||||
0.5333854141237835
|
||||
```
|
||||
|
||||
With this many samples there is a little over a 50% chance that a significant result shows up.
|
||||
|
||||
## Problem 5
|
||||
A study was conducted to determine if a certain treatment has any effect on the amount of metal removed in a pickling operation. A random sample of 50 pieces was immersed in a bath for 24 hours without the treatment, yielding an average of 12.2 millimeters of metal removed and a sample variance of 5.4 millimeters. A second sample of 75 pieces was exposed to the treatment, followed by the 24-hour immersion in the bath, resulting in an average removal of 11.1 millimeters of metal with a sample variance of 4.8 millimeters. Does the treatment appear to reduce the mean amount of metal removed? Use $\alpha = 0.01$.
|
||||
|
||||
```python
|
||||
>>> n1 = 50
|
||||
>>> n2 = 75
|
||||
>>> x1 = 12.2
|
||||
>>> x2 = 11.1
|
||||
>>> s1 = 5.4**0.5
|
||||
>>> s2 = 4.8**0.5
|
||||
>>> s_p = sp(x1, x2, s1, s2, n1, n2)
|
||||
>>> t_star = tstat(x1, x2, s_p, n1, n2)
|
||||
>>> p_value(t_star, n1, n2)
|
||||
0.004138707985700818
|
||||
```
|
||||
|
||||
Since the p-value is less than $\alpha$, we have enough evidence to reject the notion that treatment has no effect on the amount of metal removed.
|
Binary file not shown.
@ -0,0 +1,15 @@
|
||||
\documentclass{report}
|
||||
|
||||
\begin{document}
|
||||
\section*{Homework 7 - Aidan Sharpe}
|
||||
|
||||
\subsection*{Problem 1}
|
||||
A photoconductor film is manufactured at a nominal thickness of 25 mils. The product engineer wishes to decrease the energy absorption of the film, and he believes this can be achieved by reducing the thickness of the film to 20 mils. Eight samples of each film thickness are manufactured in a pilot production process, and the film absorption (in microjules per square inch) is measured. For the 25-mil film the sample data result is $\bar{x}_1 = 1.17$ and $s_1 = 0.10$. While for the 20-mil film, the data yield $\bar{x}_2 = 1.07$ and $s_2 = 0.09$. Note that an increase in film speed would lower the value of the observation in microjules per square inch. Do the data support the claim that reducing the film thickness increases the mean speed of the film? Use $\alpha = 0.10$ and assume the two population variances are equal and the underlying population of film speed is normally distributed.
|
||||
|
||||
\begin{itemize}
|
||||
\item[$H_0$:] $\mu = \mu_0$
|
||||
\item[$H_a$:] $\mu < \mu_0$
|
||||
\end{itemize}
|
||||
|
||||
|
||||
\end{document}
|
@ -0,0 +1,121 @@
|
||||
# Homework 8 - Aidan Sharpe
|
||||
|
||||
## 1
|
||||
The mean pull-off force of a connector depends on cure time.
|
||||
|
||||
### a)
|
||||
State the null and alternative hypotheses used to demonstrate that the pull-off force is below 20 newtons.
|
||||
|
||||
$H_0$: $\mu = 20$[N]
|
||||
$H_a$: $\mu < 20$[N]
|
||||
|
||||
### b)
|
||||
Assume that the previous test does not reject the null hypothesis. Does this result provide strong enough evidence that the pull-off force is greater than or equal to 20 newtons? Please explain.
|
||||
|
||||
Failing to reject the null hypothesis does not mean there is enough evidence to confirm it, it simply leaves that possibility open. Additionally, failing to reject the null hypothesis does not automatically mean that we reject the alternative hypothesis.
|
||||
|
||||
## 2
|
||||
According to Chemical Engineering, an important property of fiber is its water absorbency. The average percent absorbency of 27 randomly selected pieces of cotton fiber was found to be 21.2 with a standard deviation of 1.5. A random sample of 23 pieces of acetate yielded an average percent of 12 with a standard deviation of 1.25. Use a Confidence Interval to determine whether there is strong evidence that the population mean percent absorbency is significantly higher for cotton fiber than for acetate? Assume that the percent absorbency is approximately normally distributed and that the population variances in percent absorbency for the two fibers are the same. Let $\alpha = 0.01$
|
||||
|
||||
||Sample 1|Sample 2|
|
||||
|-|-|-
|
||||
|$n$|27|23
|
||||
|$\bar{x}$|21.2|12
|
||||
|$s$|1.5|1.25
|
||||
|
||||
99% confidence interval for sample 1:
|
||||
```python
|
||||
>>> from scipy.stats import norm
|
||||
>>> a = 0.01
|
||||
>>> z_a2 = norm.ppf(1 - (a/2))
|
||||
>>> x_bar = 21.2
|
||||
>>> s = 1.5
|
||||
>>> n = 27
|
||||
>>> ci = [x_bar - z_a2*s/n**0.5, x_bar + z_a2*s/n**0.5]
|
||||
>>> ci
|
||||
[20.45642212910476, 21.94357787089524]
|
||||
```
|
||||
|
||||
99% confidence interval for sample 2:
|
||||
```python
|
||||
>>> from scipy.stats import norm
|
||||
>>> a = 0.01
|
||||
>>> z_a2 = norm.ppf(1 - (a/2))
|
||||
>>> x_bar = 12
|
||||
>>> s = 1.25
|
||||
>>> n = 23
|
||||
>>> ci = [x_bar - z_a2*s/n**0.5, x_bar + z_a2*s/n**0.5]
|
||||
>>> ci
|
||||
[11.328628077574322, 12.671371922425678]
|
||||
```
|
||||
|
||||
Since there is no overlap between the confidence intervals, there is significantly different absorbency between cotton fiber and acetate.
|
||||
|
||||
## 3
|
||||
A study of asthmatics measured the peak expiratory flow rate (basically, a person’s maximum ability to exhale) before and after a walk on a cold winter’s day for a random sample of nine asthmatics.
|
||||
|
||||
|Subject|Before|After|Difference
|
||||
|-|-|-|-
|
||||
|1|312|300|12
|
||||
|2|242|201|41
|
||||
|3|340|232|108
|
||||
|4|388|312|76
|
||||
|5|296|220|76
|
||||
|6|254|256|-2
|
||||
|7|31|328|63
|
||||
|8|402|330|72
|
||||
|9|290|231|59
|
||||
|$\bar{x}$|323.89|267.78|56.11
|
||||
|$s$|59.83|50.01|34.17
|
||||
|
||||
### a)
|
||||
Using a two-sample t-test: Do the data suggest that there is a difference between the peak
|
||||
expiratory flow rate before vs after a walk on a cold winter’s day for asthamtics? Use $\alpha = 0.01$
|
||||
|
||||
```python
|
||||
>>> import scipy.stats as st
|
||||
|
||||
>>> def p_value(tstat, n1, n2):
|
||||
... df = n1 + n2 - 2
|
||||
... tstat = abs(tstat)
|
||||
... return 1 - st.t.cdf(tstat, df)
|
||||
|
||||
>>> def tstar(x1, x2, sp, n1, n2):
|
||||
... return (x1 - x2) / (sp * (1/n1 + 1/n2)**0.5)
|
||||
|
||||
>>> def sp(x1, x2, s1, s2, n1, n2):
|
||||
... return (((n1-1)*(s1**2) + (n2-1)*(s2**2)) / (n1 + n2 - 2))**0.5
|
||||
|
||||
>>> x1 = 323.89
|
||||
>>> x2 = 267.78
|
||||
>>> s1 = 59.83
|
||||
>>> s2 = 50.01
|
||||
>>> n1 = 9
|
||||
>>> n2 = 9
|
||||
>>> s_p = sp(x1, x2, s1, s2, n1, n2)
|
||||
>>> t_star = tstar(x1, x2, s_p, n1, n2)
|
||||
>>> p_value(t_star, n1, n2)
|
||||
0.02320508093086404
|
||||
```
|
||||
|
||||
Since the p-value is greater than $\alpha$, we do not have enough evidence to reject the notion that going on a walk on a cold winter's day has no effect on the expiratory rate for asthmatics.
|
||||
|
||||
### b)
|
||||
Using a paired t-test: Does the data suggest that there is a difference between the peak expiratory flow rate before vs after a walk on a cold winter’s data for asthmatics? Use $\alpha = 0.01$
|
||||
|
||||
Using a paired t-test, the degrees of freedom in the `p_value(tstat, n1, n2)` function must be adjusted.
|
||||
```python
|
||||
>>> def p_value(tstat, n1, n2):
|
||||
... df = (n1 + n2)/2 - 2
|
||||
... return 1 - st.t.cdf(tstat, df)
|
||||
|
||||
>>> p_value(t_star, n1, n2)
|
||||
0.03387016598071013
|
||||
```
|
||||
|
||||
Using a paired t-test, the p-value increases, but our conclusion does not change.
|
||||
|
||||
### c)
|
||||
Are the conclusions for the two-sample t-test and the paired t-test consistent? If not, what could be the reason?
|
||||
|
||||
While the conclusions are the same, it seems possible for the conclusions to be different in some scenarios. The paired t-test takes into account the persistent sample population, which changes the degrees of freedom for the p-value.
|
Binary file not shown.
@ -0,0 +1,53 @@
|
||||
# Homework 10 - Aidan Sharpe
|
||||
|
||||
## 1
|
||||
The titanium content in an aircraft-grade alloy is an important discriminant of strength. A sample of 10 test coupns reveals the following titanium content in percent:
|
||||
|
||||
| Coupon | Titanium Content |
|
||||
| ------ | ---------------- |
|
||||
| 1 | 8.30% |
|
||||
| 2 | 8.09% |
|
||||
| 3 | 8.99% |
|
||||
| 4 | 8.60% |
|
||||
| 5 | 8.40% |
|
||||
| 6 | 8.35% |
|
||||
| 7 | 8.36% |
|
||||
| 8 | 8.75% |
|
||||
| 9 | 8.91% |
|
||||
| 10 | 8.05% |
|
||||
|
||||
Suppose that the distribution of titanium content is symmetric and continuous. Does the sample data suggest that the mean titanium content differs significantly from 8.5%? Use $\alpha = 0.05$
|
||||
|
||||
```python
|
||||
>>> coupons = [8.3, 8.09, 8.99, 8.60, 8.40, 8.35, 8.36, 8.75, 8.91, 8.05]
|
||||
>>> mu0 = 8.5
|
||||
|
||||
# Find the difference between each sample and mu0
|
||||
>>> differences = [xi - mu0 for xi in coupons]
|
||||
|
||||
# Find the absolute differences
|
||||
>>> abs_diffs = [abs(x) for x in differences]
|
||||
|
||||
# Sort the differences in ascending order
|
||||
>>> s_diffs = sorted(abs_diffs)
|
||||
|
||||
# Turn the sorted order into a ranked list
|
||||
>>> ranks = [abs_diffs.index(x) + 1 for x in s_diffs]
|
||||
|
||||
# Find the ranks corresponding to positive differences
|
||||
>>> p_ranks = [ranks[i] if differences[i] > 0 else 0 for i in range(len(differences))]
|
||||
|
||||
# Find the ranks corresponding to negative differences
|
||||
>>> n_ranks = [ranks[i] if differences[i] < 0 else 0 for i in range(len(differences))]
|
||||
|
||||
# Find the positive and negative rank sums
|
||||
>>> wp = sum(p_ranks)
|
||||
>>> wn = sum(n_ranks)
|
||||
|
||||
# Find the test statistic
|
||||
>>> w_observed = min(wp, wn)
|
||||
>>> w_observed
|
||||
22
|
||||
```
|
||||
|
||||
For a two-sided signed rank test with $\alpha = 0.05$ and 10 samples, $w_\alpha^*$ is 8. Since 22 is greater than 8, we do not have enough evidence to suggest that the mean titanium content differs from 8.5%.
|
Binary file not shown.
@ -0,0 +1,150 @@
|
||||
# Chapter 3
|
||||
|
||||
### Example
|
||||
Suppose there are 30 resistors, 7 of them do not work. You randomly choose 3 of them. Let $X$ be the number of defective resistors. Find the probability distribution of $X$.
|
||||
|
||||
$$ X = [0,3]$$
|
||||
$$P(X=0) = { {7 \choose 0} {23 \choose 3} \over {30 \choose 3} } = 0.436$$
|
||||
$$P(X=1) = { {7 \choose 1} {23 \choose 2} \over {30 \choose 3} } = 0.436$$
|
||||
$$P(X=2) = { {7 \choose 2} {23 \choose 1} \over {30 \choose 3} } = 0.119$$
|
||||
$$P(X=3) = { {7 \choose 3} {23 \choose 0} \over {30 \choose 3} } = 0.009$$
|
||||
|
||||
Probability distribution:
|
||||
$$P(X = x) =
|
||||
\begin{cases}
|
||||
0.436 & x=0 \\
|
||||
0.436 & x=1 \\
|
||||
0.119 & x=2 \\
|
||||
0.009 & x=3
|
||||
\end{cases}
|
||||
$$
|
||||
|
||||
## The Cumulative Distribution Function
|
||||
The cumulative distribution function (CDF), $F(x)$, of a discrete random variable, $x$, with probability distribution, $f(x)$, is:
|
||||
$$F(x) = P(X \le x)$$
|
||||
|
||||
Find CDF for the example above:
|
||||
$$F(0) = P(X \le 0) = P(X = 0) = 0.436$$
|
||||
$$F(1) = P(X \le 1) = P((X = 0) \cup (X=1)) = 0.872$$
|
||||
$$F(2) = P(X \le 2) = P((X=0) \cup (X=1) \cup (X=2)) = 0.991$$
|
||||
Since 3 is the largest possible value for $x$:
|
||||
$$F(3) = P(X \le 3) = 1$$
|
||||
|
||||
As a piecewise function:
|
||||
$$F(x) =
|
||||
\begin{cases}
|
||||
0 & x < 0 \\
|
||||
0.436 & 0 \le x < 1 \\
|
||||
0.872 & 1 \le x < 2 \\
|
||||
0.991 & 2 \le x < 3 \\
|
||||
1 & x \ge 3
|
||||
\end{cases}$$
|
||||
|
||||
### Exercise
|
||||
Suppose that a days production of 850 manufactured parts contains 50 parts that to not conform to customer requirements. 2 parts are selected at random from the batch. Let $X$ be the number of non-conforming parts.
|
||||
|
||||
#### a)
|
||||
Find the probability distribution for $X$
|
||||
$$P(X = 0) = { {50 \choose 0} {800 \choose 2} \over {850 \choose 2 }} = 0.8857$$
|
||||
$$P(X = 1) = { {50 \choose 1} {800 \choose 1} \over {850 \choose 2 }} = 0.1109$$
|
||||
$$P(X = 2) = { {50 \choose 2} {800 \choose 0} \over {850 \choose 2 }} = 0.0034$$
|
||||
|
||||
$$P(X = x) =
|
||||
\begin{cases}
|
||||
0.8857 & x=0 \\
|
||||
0.1109 & x=1 \\
|
||||
0.0034 & x=2
|
||||
\end{cases}
|
||||
$$
|
||||
|
||||
#### b)
|
||||
Find the CDF $F(x)$
|
||||
$$F(x) =
|
||||
\begin{cases}
|
||||
0 & x < 0 \\
|
||||
0.8857 & 0 \le x < 1 \\
|
||||
0.9966 & 1 \le x < 2 \\
|
||||
1 & x \ge 2
|
||||
\end{cases}$$
|
||||
|
||||
#### c)
|
||||
Plot $F(x)$:
|
||||
|
||||
## Continuous Probability Distributions
|
||||
A continuous random variable is a variable that can take on any value within a range. It takes on infinitely many possible value within the range.
|
||||

|
||||
|
||||
For a continuous distribution, $f(x)$:
|
||||
$$P(X = x) = 0$$
|
||||
$$P(x_0 \le X \le x_1) = \int\limits_{x_0}^{x_1} f(x) dx$$
|
||||
$$P(X \ge x_0) = \int\limits_{x_0}^{\infty} f(x) dx$$
|
||||
|
||||
### Definition
|
||||
The function, $f(x)$, is a probability density function fo the continuous random variable, $X$, defined over $\Reals$ if:
|
||||
|
||||
1.
|
||||
$$f(x) \ge 0, \forall x \in \Reals$$
|
||||
2.
|
||||
$$\int\limits_{-\infty}^{\infty} f(x) dx = 1$$
|
||||
3.
|
||||
$$P(x_0 \le X \le x_1) = P(x_0 < X < x_1)$$
|
||||
$$= P(x_0 \le X < x_1)$$
|
||||
$$= P(x_0 < X \le x_1)$$
|
||||
|
||||
### Example
|
||||
Suppose that the error in the reaction temperature in $^\circ \text{C}$ for a controlled lab experiment is a continuous random variable, $X$, having PDF:
|
||||
$$f(x) =
|
||||
\begin{cases}
|
||||
{x^2 \over 3} & -1 < x < 2 \\
|
||||
0 & elsewhere
|
||||
\end{cases}$$
|
||||
|
||||
#### a)
|
||||
Verify that $f(x)$ is a PDF.
|
||||
$$\int\limits_{-1}^{2} {x^2 \over 3} dx \stackrel{?}{=} 1$$
|
||||
$${1 \over 3} \left[{1 \over 3} x^3 \Big\vert_{-1}^{2}\right] = {1\over9}[8- (-1)] = 1$$
|
||||
|
||||
#### b)
|
||||
Find $P(0 < X < 0.5)$:
|
||||
$$P(0 < X < 0.5) = \int\limits_0^{0.5} {x^2 \over 3}dx$$
|
||||
$${1\over9}\left[x^3 \Big|_0^{0.5}\right] = {1\over9}[0.125] = 0.01389$$
|
||||
|
||||
### Definition
|
||||
The CDF, $F(x)$ of a continuous random variabl, $X$, with probability density function $f(x)$ is:
|
||||
$$F(x) = P(X \le x) = \int\limits_{-\infty}^x f(t) dt$$
|
||||
|
||||
**Note:**
|
||||
|
||||
1.
|
||||
$$P(a < X < b) = F(b) - F(a)$$
|
||||
2.
|
||||
$$f(x) = {d\over dx}F(x)$$
|
||||
|
||||
### Example
|
||||
Find the CDF of the previous example
|
||||
$$f(x) =
|
||||
\begin{cases}
|
||||
{x^2 \over 3} & -1 < x < 2 \\
|
||||
0 & elsewhere
|
||||
\end{cases}$$
|
||||
|
||||
$$F(x) = \int\limits_{-1}^x {t^2 \over 3} dt$$
|
||||
$${1/over 9}\left[t^3\Big|_{-1}^x\right] = {1\over 9}\left[x^3 + 1\right]$$
|
||||
$$F(x) = \begin{cases}
|
||||
0 & t < -1 \\
|
||||
{1\over 9} \left[x^3 + 1\right] & -1 \le x \le 2 \\
|
||||
1 & elsewhere
|
||||
\end{cases}$$
|
||||
|
||||
### Example
|
||||
The proportion of the budget for a certain type of industrial copany that is allotted to environmential and pollution control is coming under scrutiny. A data collection project determines that the distribution of these proportions is given by:
|
||||
$$f(y) = \begin{cases}
|
||||
k(1-y)^4 & 0 \le y \le 1 \\
|
||||
0 & elsewhere
|
||||
\end{cases}$$
|
||||
|
||||
Find $k$ that renders $f(y) a valid density function:
|
||||
$$\int\limits_0^1 k(1-y)^4dy = 1$$
|
||||
$${k\over5} = 1$$
|
||||
$$\therefore k = 5$$
|
||||
|
@ -0,0 +1,191 @@
|
||||
\hypertarget chapter-3}{%
|
||||
\section{Chapter 3}\label{chapter-3}}
|
||||
|
||||
\hypertarget{example}{%
|
||||
\subsubsection{Example}\label{example}}
|
||||
|
||||
Suppose there are 30 resistors, 7 of them do not work. You randomly
|
||||
choose 3 of them. Let \(X\) be the number of defective resistors. Find
|
||||
the probability distribution of \(X\).
|
||||
|
||||
\[ X = [0,3]\]
|
||||
\[P(X=0) = { {7 \choose 0} {23 \choose 3} \over {30 \choose 3} } = 0.436\]
|
||||
\[P(X=1) = { {7 \choose 1} {23 \choose 2} \over {30 \choose 3} } = 0.436\]
|
||||
\[P(X=2) = { {7 \choose 2} {23 \choose 1} \over {30 \choose 3} } = 0.119\]
|
||||
\[P(X=3) = { {7 \choose 3} {23 \choose 0} \over {30 \choose 3} } = 0.009\]
|
||||
|
||||
Probability distribution: \[P(X = x) =
|
||||
\begin{cases}
|
||||
0.436 & x=0 \\
|
||||
0.436 & x=1 \\
|
||||
0.119 & x=2 \\
|
||||
0.009 & x=3
|
||||
\end{cases}
|
||||
\]
|
||||
|
||||
\hypertarget{the-cumulative-distribution-function}{%
|
||||
\subsection{The Cumulative Distribution
|
||||
Function}\label{the-cumulative-distribution-function}}
|
||||
|
||||
The cumulative distribution function (CDF), \(F(x)\), of a discrete
|
||||
random variable, \(x\), with probability distribution, \(f(x)\), is:
|
||||
\[F(x) = P(X \le x)\]
|
||||
|
||||
Find CDF for the example above: \[F(0) = P(X \le 0) = P(X = 0) = 0.436\]
|
||||
\[F(1) = P(X \le 1) = P((X = 0) \cup (X=1)) = 0.872\]
|
||||
\[F(2) = P(X \le 2) = P((X=0) \cup (X=1) \cup (X=2)) = 0.991\] Since 3
|
||||
is the largest possible value for \(x\): \[F(3) = P(X \le 3) = 1\]
|
||||
|
||||
As a piecewise function: \[F(x) =
|
||||
\begin{cases}
|
||||
0 & x < 0 \\
|
||||
0.436 & 0 \le x < 1 \\
|
||||
0.872 & 1 \le x < 2 \\
|
||||
0.991 & 2 \le x < 3 \\
|
||||
1 & x \ge 3
|
||||
\end{cases}\]
|
||||
|
||||
\hypertarget{exercise}{%
|
||||
\subsubsection{Exercise}\label{exercise}}
|
||||
|
||||
Suppose that a days production of 850 manufactured parts contains 50
|
||||
parts that to not conform to customer requirements. 2 parts are selected
|
||||
at random from the batch. Let \(X\) be the number of non-conforming
|
||||
parts.
|
||||
|
||||
\hypertarget{a}{%
|
||||
\paragraph{a)}\label{a}}
|
||||
|
||||
Find the probability distribution for \(X\)
|
||||
\[P(X = 0) = { {50 \choose 0} {800 \choose 2} \over {850 \choose 2 }} = 0.8857\]
|
||||
\[P(X = 1) = { {50 \choose 1} {800 \choose 1} \over {850 \choose 2 }} = 0.1109\]
|
||||
\[P(X = 2) = { {50 \choose 2} {800 \choose 0} \over {850 \choose 2 }} = 0.0034\]
|
||||
|
||||
\[P(X = x) =
|
||||
\begin{cases}
|
||||
0.8857 & x=0 \\
|
||||
0.1109 & x=1 \\
|
||||
0.0034 & x=2
|
||||
\end{cases}
|
||||
\]
|
||||
|
||||
\hypertarget{b}{%
|
||||
\paragraph{b)}\label{b}}
|
||||
|
||||
Find the CDF \(F(x)\) \[F(x) =
|
||||
\begin{cases}
|
||||
0 & x < 0 \\
|
||||
0.8857 & 0 \le x < 1 \\
|
||||
0.9966 & 1 \le x < 2 \\
|
||||
1 & x \ge 2
|
||||
\end{cases}\]
|
||||
|
||||
\hypertarget{c}{%
|
||||
\paragraph{c)}\label{c}}
|
||||
|
||||
Plot \(F(x)\):
|
||||
|
||||
\hypertarget{continuous-probability-distributions}{%
|
||||
\subsection{Continuous Probability
|
||||
Distributions}\label{continuous-probability-distributions}}
|
||||
|
||||
A continuous random variable is a variable that can take on any value
|
||||
within a range. It takes on infinitely many possible value within the
|
||||
range. \includegraphics{NormalDistribution.png}
|
||||
|
||||
For a continuous distribution, \(f(x)\): \[P(X = x) = 0\]
|
||||
\[P(x_0 \le X \le x_1) = \int\limits_{x_0}^{x_1} f(x) dx\]
|
||||
\[P(X \ge x_0) = \int\limits_{x_0}^{\infty} f(x) dx\]
|
||||
|
||||
\hypertarget{definition}{%
|
||||
\subsubsection{Definition}\label{definition}}
|
||||
|
||||
The function, \(f(x)\), is a probability density function fo the
|
||||
continuous random variable, \(X\), defined over \(\Reals\) if:
|
||||
|
||||
\begin{enumerate}
|
||||
\def\labelenumi{\arabic{enumi}.}
|
||||
\tightlist
|
||||
\item
|
||||
\[f(x) \ge 0, \forall x \in \Reals\]
|
||||
\item
|
||||
\[\int\limits_{-\infty}^{\infty} f(x) dx = 1\]
|
||||
\item
|
||||
\[P(x_0 \le X \le x_1) = P(x_0 < X < x_1)\] \[= P(x_0 \le X < x_1)\]
|
||||
\[= P(x_0 < X \le x_1)\]
|
||||
\end{enumerate}
|
||||
|
||||
\hypertarget{example-1}{%
|
||||
\subsubsection{Example}\label{example-1}}
|
||||
|
||||
Suppose that the error in the reaction temperature in
|
||||
\(^\circ \text{C}\) for a controlled lab experiment is a continuous
|
||||
random variable, \(X\), having PDF: \[f(x) =
|
||||
\begin{cases}
|
||||
{x^2 \over 3} & -1 < x < 2 \\
|
||||
0 & elsewhere
|
||||
\end{cases}\]
|
||||
|
||||
\hypertarget{a-1}{%
|
||||
\paragraph{a)}\label{a-1}}
|
||||
|
||||
Verify that \(f(x)\) is a PDF.
|
||||
\[\int\limits_{-1}^{2} {x^2 \over 3} dx \stackrel{?}{=} 1\]
|
||||
\[{1 \over 3} \left[{1 \over 3} x^3 \Big\vert_{-1}^{2}\right] = {1\over9}[8- (-1)] = 1\]
|
||||
|
||||
\hypertarget{b-1}{%
|
||||
\paragraph{b)}\label{b-1}}
|
||||
|
||||
Find \(P(0 < X < 0.5)\):
|
||||
\[P(0 < X < 0.5) = \int\limits_0^{0.5} {x^2 \over 3}dx\]
|
||||
\[{1\over9}\left[x^3 \Big|_0^{0.5}\right] = {1\over9}[0.125] = 0.01389\]
|
||||
|
||||
\hypertarget{definition-1}{%
|
||||
\subsubsection{Definition}\label{definition-1}}
|
||||
|
||||
The CDF, \(F(x)\) of a continuous random variabl, \(X\), with
|
||||
probability density function \(f(x)\) is:
|
||||
\[F(x) = P(X \le x) = \int\limits_{-\infty}^x f(t) dt\]
|
||||
|
||||
\textbf{Note:}
|
||||
|
||||
\begin{enumerate}
|
||||
\def\labelenumi{\arabic{enumi}.}
|
||||
\tightlist
|
||||
\item
|
||||
\[P(a < X < b) = F(b) - F(a)\]
|
||||
\item
|
||||
\[f(x) = {d\over dx}F(x)\]
|
||||
\end{enumerate}
|
||||
|
||||
\hypertarget{example-2}{%
|
||||
\subsubsection{Example}\label{example-2}}
|
||||
|
||||
Find the CDF of the previous example \[f(x) =
|
||||
\begin{cases}
|
||||
{x^2 \over 3} & -1 < x < 2 \\
|
||||
0 & elsewhere
|
||||
\end{cases}\]
|
||||
|
||||
\[F(x) = \int\limits_{-1}^x {t^2 \over 3} dt\]
|
||||
\[{1/over 9}\left[t^3\Big|_{-1}^x\right] = {1\over 9}\left[x^3 + 1\right]\]
|
||||
\[F(x) = \begin{cases}
|
||||
0 & t < -1 \\
|
||||
{1\over 9} \left[x^3 + 1\right] & -1 \le x \le 2 \\
|
||||
1 & elsewhere
|
||||
\end{cases}\]
|
||||
|
||||
\hypertarget{example-3}{%
|
||||
\subsubsection{Example}\label{example-3}}
|
||||
|
||||
The proportion of the budget for a certain type of industrial copany
|
||||
that is allotted to environmential and pollution control is coming under
|
||||
scrutiny. A data collection project determines that the distribution of
|
||||
these proportions is given by: \[f(y) = \begin{cases}
|
||||
k(1-y)^4 & 0 \le y \le 1 \\
|
||||
0 & elsewhere
|
||||
\end{cases}\]
|
||||
|
||||
Find \(k\) that renders \$f(y) a valid density function:
|
||||
\[\int\limits_0^1 k(1-y)^4dy = 1\] \[{k\over5} = 1\]
|
||||
\[\therefore k = 5\]
|
@ -0,0 +1,233 @@
|
||||
# Chapter 4
|
||||
## Expected Value
|
||||
### Definition
|
||||
Let $X$ be a random variable with probability distribution $f(x)$. The mean, or expected value, of $X$ is:
|
||||
|
||||
For a discrete distribution
|
||||
$$E[X] = \sum\limits_x xf(x)$$
|
||||
|
||||
For a continuous distribution:
|
||||
$$E[X] = \int\limits_{-\infty}^{\infty} xf(x)dx$$
|
||||
|
||||
Given $\{1, 2, 3, 3, 5\}$, the mean is:
|
||||
$${1+2+3+3+5 \over 5} = 2.8$$
|
||||
$$f(x) = \begin{cases}
|
||||
{1\over5} & x=1 \\
|
||||
{1\over5} & x=2 \\
|
||||
{2\over5} & x=3 \\
|
||||
{1\over5} & x=5 \\
|
||||
\end{cases}$$
|
||||
|
||||
$$\sum\limits_x xf(x) = {1\over5}(1) + {1\over5}(2) + {1\over5}(3) + {1\over5}(5) = 2.8$$
|
||||
|
||||
|
||||
### Example
|
||||
The probability distribution of a discrete random variable $X$ is:
|
||||
$$f(x) = {3 \choose x}\left({1 \over 4}\right)^x\left({3\over4}\right)^{3-x}, x \in \{0, 1, 2, 3\}$$
|
||||
Find $E[X]$:
|
||||
$$f(x) =
|
||||
\begin{cases}
|
||||
0 & x=0 \\
|
||||
0.422 & x=1 \\
|
||||
0.14 & x=2 \\
|
||||
{1\over64} & x=3
|
||||
\end{cases}$$
|
||||
|
||||
$$E[X] = \sum\limits_x x {3 \choose x}\left({1\over4}\right)^x \left({3\over4}\right)^{3-x}$$
|
||||
$$E[X] = 0(0)+ 0.422(1) + 0.14(2) + {1\over64}(3) = 0.75$$
|
||||
|
||||
### Example
|
||||
Let $X$ be the random variable that denotes the life in hours of a certain electronic device. The PDF is:
|
||||
$$f(x) =
|
||||
\begin{cases}
|
||||
{20000\over x^3} & x > 100 \\
|
||||
0 & elsewhere
|
||||
\end{cases}$$
|
||||
|
||||
Find the expected life of this type of device:
|
||||
$$E[X] = \int\limits_{-\infty}^{\infty} xf(x)dx = \int\limits_{100}^{\infty}x{20000 \over x^3}dx = 200 \text{[hrs]}$$
|
||||
|
||||
**Note:**
|
||||
$$E[x^2] = \int\limits_{\infty}^{\infty}x^2f(x)dx$$
|
||||
|
||||
### Properties of Expectations
|
||||
$$E(b) = b$$
|
||||
Where $b$ is a constant
|
||||
$$E(aX) = aE[X]$$
|
||||
Where $a$ is a constant
|
||||
$$E(aX + b) aE[X] + b$$
|
||||
$$E[X + Y] = E[X] + E[Y]$$
|
||||
Where $X$ and $Y$ are random variables
|
||||
|
||||
### Example
|
||||
Given:
|
||||
$$f(x) = \begin{cases}
|
||||
{x^2\over3} & -1 < x < 2 \\
|
||||
0 & \text{elsewhere}
|
||||
\end{cases}$$
|
||||
Find the expected value of $Y = 4X + 3$:
|
||||
|
||||
$$E[Y] = E[4X + 3] = 4E[X] + 3$$
|
||||
$$E[X] = \int\limits_{-1}^{3} {X^3 \over 3}dx = {1\over12}X^4 \Big|_{-1}^{3}={5\over4}$$
|
||||
|
||||
### Variance of a Random Variable
|
||||
The expected value/mean is of special importance because it describes where the probability distribution is centered. However, we also need to characterize the variance of the distribution.
|
||||
|
||||
### Definition
|
||||
Let $X$ be a random variable with probability distribution, $f(x)$, and mean, $\mu$. The variance of $X$ is given by:
|
||||
$$\text{Var}[X] = E[(X-\mu)^2]$$
|
||||
Which is the average squared distance away from the mean. This simplifies to:
|
||||
$$\text{Var}[X] = E[X^2] - E[X]^2$$
|
||||
**Note:** Generally,
|
||||
$$E[X^2] \ne E[X]^2$$
|
||||
|
||||
The standard deviation, $\sigma$, is given by:
|
||||
$$\sigma = \sqrt{\text{Var}[X]}$$
|
||||
|
||||
**Note**: The variance is a measure of uncertainty (spread) in the data.
|
||||
|
||||
|
||||
### Example
|
||||
The weekly demand for a drinking water product in thousands of liters from a local chain of efficiency stores is a continuous random variable, $X$, having the probability density:
|
||||
$$F(x) = \begin{cases}
|
||||
2(x-1) & 1 < x < 2 \\
|
||||
0 & \text{elsewhere}
|
||||
\end{cases}$$
|
||||
|
||||
Find the expected value:
|
||||
$$E[X] = \int\limits_1^2 x (2(x-1)) dx = 2\int\limits_1^2 (x^2 - x)dx$$
|
||||
$$E[X] = 2\left[{1\over3}x^3 - {1\over2}x^2 \Big|_1^2 \right] = {5\over3}$$
|
||||
|
||||
Find the variance:
|
||||
$$\text{Var}[X] = E[X^2] - E[X]^2$$
|
||||
$$E[X^2] = \int\limits_1^2 2x^2(x-1)dx = 2\int\limits_1^2 (x^3 - x^2)dx$$
|
||||
$$E[X^2] = {17\over6}$$
|
||||
$$\text{Var}[X] = {17\over6} - \left({5\over3}\right)^2 = {1\over18}$$
|
||||
|
||||
Find the standard deviation:
|
||||
$$\sigma = \sqrt{\text{Var}[X]} = {1\over3\sqrt{2}} = {\sqrt{2}\over6}$$
|
||||
|
||||
### Example
|
||||
The mean and variance are useful when comparing two or more distributions.
|
||||
|
||||
| | Plan 1 | Plan 2
|
||||
|-|-|-
|
||||
|Avg Score Improvement | $+17$ | $+15$
|
||||
|Standard deviation | $\pm8$ | $\pm2$
|
||||
|
||||
### Theorem
|
||||
If $X$ has variance, $\text{Var}[X]$, then $\text{Var}[aX + b] = a^2\text{Var}[X]$.
|
||||
|
||||
### Example
|
||||
The length of time, in minutes, for an airplane to obtain clearance at a certain airport is a random variable, $Y = 3X - 2$, where $X$ has the density:
|
||||
$$F(x) = \begin{cases}
|
||||
{1\over4} e^{x/4} & x > 0 \\
|
||||
0 & \text{elsewhere}
|
||||
\end{cases}$$
|
||||
|
||||
$$E[X] = 4$$
|
||||
$$\text{Var}[X] = 16$$
|
||||
|
||||
Find $E[Y]$:
|
||||
$$E[Y] = E[3X-2] = 3E[X] - 2 = 10$$
|
||||
$$\text{Var}[Y] = 3^2\text{Var}[X] = 144$$
|
||||
$$\sigma = \sqrt{\text{Var}[Y]} = 12$$
|
||||
|
||||
## The Exponential Distribution
|
||||
The continuous random variable, $X$, has an exponential distribution with parameter $\beta$ if its density function is given by:
|
||||
$$F(x) = \begin{cases}
|
||||
{1\over\beta}e^{-x/\beta} & x > 0 \\
|
||||
0 & \text{elsewhere}
|
||||
\end{cases}$$
|
||||
|
||||
Where $\beta > 0$.
|
||||
|
||||
$$E[X] = \beta$$
|
||||
$$E[X] = \int\limits_0^{\infty} x{1\over\beta}e^{-x/\beta} dx$$
|
||||
|
||||
Aside:
|
||||
$$\Gamma(Z) = \int\limits_0^\infty x^{Z - 1}e^{-x}dx$$
|
||||
Where $\Gamma(Z) = (Z - 1)!$
|
||||
|
||||
$$E[X] = \beta \int\limits_0^\infty \left({x\over\beta}\right)^{(2-1)} e^{-x/\beta} \left({dx\over\beta}\right) = \beta\Gamma(2)$$
|
||||
$$E[X] = \beta(2-1)! = \beta$$
|
||||
|
||||
$$\text{Var}[X] = E[X^2] - E[X]^2$$
|
||||
$$E[X^2] = \int\limits_0^\infty x^2{1\over\beta}e^{-x/\beta}dx = \beta^2 \int\limits_0^\infty \left({x\over\beta}\right)^{(2-1)} e^{-x/\beta} \left({dx\over\beta}\right)$$
|
||||
$$E[X^2] = \beta^2\Gamma(3) = 2\beta^2$$
|
||||
$$\text{Var}[X] = 2\beta^2 - \beta^2 = \beta^2$$
|
||||
|
||||
#### Application
|
||||
Reliability analysis: the time to failure of a certain electronic component can be modeled by an exponential distribution.
|
||||
|
||||
### Example
|
||||
Let $T$ be the random variable which measures the time to failure of a certain electronic component. Suppose $T$ has an exponential distribution with $\beta = 5$.
|
||||
|
||||
$$F(x) = \begin{cases}
|
||||
{1\over5}e^{-x/5} & x > 0 \\
|
||||
0 & \text{elsewhere}
|
||||
\end{cases}$$
|
||||
|
||||
If 6 of these components are in use, what is the probability that exactly 3 components are still functioning at the end of 8 years?
|
||||
|
||||
What is the probability that an individual component is still functioning after 8 years?
|
||||
|
||||
$$P(T > 8) = \int\limits_8^\infty {1\over5}e^{-x/5}dx \approx 0.2$$
|
||||
|
||||
$${6 \choose 3}(0.2)^3(0.8)^3 = 0.08192$$
|
||||
|
||||
```python
|
||||
>>> from math import comb
|
||||
>>> comb(6,3) * 0.2**3 * 0.8**3
|
||||
0.08192000000000003
|
||||
```
|
||||
|
||||
## The Normal Distribution
|
||||
The most important continuous probability distribution in the field of statistics is the normal distribution. It is characterized by 2 parameters, the mean, $\mu$, and the variance, $\sigma^2$.
|
||||
$$\text{mean} = \text{median} = \text{mode}$$
|
||||
|
||||
$$F(x|\mu,\sigma^2) = {1 \over \sqrt{2\pi} \sigma^2} e^{\left({1 \over 2\sigma^2}(x-\mu)^2\right)}$$
|
||||
$$E[X] = \mu$$
|
||||
$$\text{Var}[X] = \sigma^2$$
|
||||
|
||||
For a normal curve:
|
||||
$$P(x_1 < x < x_2) = \int\limits_{x_1}^{x_2} F(x)dx$$
|
||||
|
||||
### Definition
|
||||
The distribution of a normal variable with mean 0 and variance 1 is called a standard normal distribution.
|
||||
|
||||
The transformation of any random variable, $X$ into a standard normal variable, $Z$:
|
||||
$$Z = {X - \mu \over \sigma}$$
|
||||
|
||||
### Example
|
||||
Given a normal distribution with mean $\mu = 30$ and standard deviation, $\sigma = 6$, find the normal curve area to the right of $x = 17$.
|
||||
|
||||
Transform to standard normal.
|
||||
$$Z = {17 - 30 \over 6} = -2.16$$
|
||||
|
||||
That is, $x = 17$ on a normal distribution with $\mu = 30$ and $\sigma = 6$ is equivalent to $Z=-2.16$ on a normal distribution with $\mu = 0$ and $\sigma = 1$.
|
||||
|
||||
$$P(X > 17) = P(Z > -2.16)$$
|
||||
|
||||
$$P(Z > -2.16) = 1 -P(Z \le -2.16) = 0.9846$$
|
||||
|
||||
```python
|
||||
>>> from scipy.stats import norm
|
||||
>>> norm.cdf(-2.16)
|
||||
0.015386334783925445
|
||||
```
|
||||
|
||||
### Example
|
||||
The finished inside diameter of a piston ring is normally distributed with mean, $\mu = 10$[cm], and standard deviation, $\sigma = 0.03$[cm].
|
||||
|
||||
What is the probability that a piston ring will have inside diameter between 9.97[cm] and 10.03[cm]?
|
||||
|
||||
$$Z_1 = {9.97 - 10 \over 0.03} = -1$$
|
||||
$$Z_2 = {10.03 - 10 \over 3} = 1$$
|
||||
$$P(9.97 < x < 10.03) = 0.68$$
|
||||
|
||||
```python
|
||||
>>> from scipy.stats import norm
|
||||
>>> norm.cdf(1) - norm.cdf(-1)
|
||||
0.6826894921370859
|
||||
```
|
@ -0,0 +1,292 @@
|
||||
\hypertarget{chapter-4}{%
|
||||
\section{Chapter 4}\label{chapter-4}}
|
||||
|
||||
\hypertarget{expected-value}{%
|
||||
\subsection{Expected Value}\label{expected-value}}
|
||||
|
||||
\hypertarget{definition}{%
|
||||
\subsubsection{Definition}\label{definition}}
|
||||
|
||||
Let \(X\) be a random variable with probability distribution \(f(x)\).
|
||||
The mean, or expected value, of \(X\) is:
|
||||
|
||||
For a discrete distribution \[E[X] = \sum\limits_x xf(x)\]
|
||||
|
||||
For a continuous distribution:
|
||||
\[E[X] = \int\limits_{-\infty}^{\infty} xf(x)dx\]
|
||||
|
||||
Given \(\{1, 2, 3, 3, 5\}\), the mean is: \[{1+2+3+3+5 \over 5} = 2.8\]
|
||||
\[f(x) = \begin{cases}
|
||||
{1\over5} & x=1 \\
|
||||
{1\over5} & x=2 \\
|
||||
{2\over5} & x=3 \\
|
||||
{1\over5} & x=5 \\
|
||||
\end{cases}\]
|
||||
|
||||
\[\sum\limits_x xf(x) = {1\over5}(1) + {1\over5}(2) + {1\over5}(3) + {1\over5}(5) = 2.8\]
|
||||
|
||||
\hypertarget{example}{%
|
||||
\subsubsection{Example}\label{example}}
|
||||
|
||||
The probability distribution of a discrete random variable \(X\) is:
|
||||
\[f(x) = {3 \choose x}\left({1 \over 4}\right)^x\left({3\over4}\right)^{3-x}, x \in \{0, 1, 2, 3\}\]
|
||||
Find \(E[X]\): \[f(x) =
|
||||
\begin{cases}
|
||||
0 & x=0 \\
|
||||
0.422 & x=1 \\
|
||||
0.14 & x=2 \\
|
||||
{1\over64} & x=3
|
||||
\end{cases}\]
|
||||
|
||||
\[E[X] = \sum\limits_x x {3 \choose x}\left({1\over4}\right)^x \left({3\over4}\right)^{3-x}\]
|
||||
\[E[X] = 0(0)+ 0.422(1) + 0.14(2) + {1\over64}(3) = 0.75\]
|
||||
|
||||
\hypertarget{example-1}{%
|
||||
\subsubsection{Example}\label{example-1}}
|
||||
|
||||
Let \(X\) be the random variable that denotes the life in hours of a
|
||||
certain electronic device. The PDF is: \[f(x) =
|
||||
\begin{cases}
|
||||
{20000\over x^3} & x > 100 \\
|
||||
0 & elsewhere
|
||||
\end{cases}\]
|
||||
|
||||
Find the expected life of this type of device:
|
||||
\[E[X] = \int\limits_{-\infty}^{\infty} xf(x)dx = \int\limits_{100}^{\infty}x{20000 \over x^3}dx = 200 \text{[hrs]}\]
|
||||
|
||||
\textbf{Note:} \[E[x^2] = \int\limits_{\infty}^{\infty}x^2f(x)dx\]
|
||||
|
||||
\hypertarget{properties-of-expectations}{%
|
||||
\subsubsection{Properties of
|
||||
Expectations}\label{properties-of-expectations}}
|
||||
|
||||
\[E(b) = b\] Where \(b\) is a constant \[E(aX) = aE[X]\] Where \(a\) is
|
||||
a constant \[E(aX + b) aE[X] + b\] \[E[X + Y] = E[X] + E[Y]\] Where
|
||||
\(X\) and \(Y\) are random variables
|
||||
|
||||
\hypertarget{example-2}{%
|
||||
\subsubsection{Example}\label{example-2}}
|
||||
|
||||
Given: \[f(x) = \begin{cases}
|
||||
{x^2\over3} & -1 < x < 2 \\
|
||||
0 & \text{elsewhere}
|
||||
\end{cases}\] Find the expected value of \(Y = 4X + 3\):
|
||||
|
||||
\[E[Y] = E[4X + 3] = 4E[X] + 3\]
|
||||
\[E[X] = \int\limits_{-1}^{3} {X^3 \over 3}dx = {1\over12}X^4 \Big|_{-1}^{3}={5\over4}\]
|
||||
|
||||
\hypertarget{variance-of-a-random-variable}{%
|
||||
\subsubsection{Variance of a Random
|
||||
Variable}\label{variance-of-a-random-variable}}
|
||||
|
||||
The expected value/mean is of special importance because it describes
|
||||
where the probability distribution is centered. However, we also need to
|
||||
characterize the variance of the distribution.
|
||||
|
||||
\hypertarget{definition-1}{%
|
||||
\subsubsection{Definition}\label{definition-1}}
|
||||
|
||||
Let \(X\) be a random variable with probability distribution, \(f(x)\),
|
||||
and mean, \(\mu\). The variance of \(X\) is given by:
|
||||
\[\text{Var}[X] = E[(X-\mu)^2]\] Which is the average squared distance
|
||||
away from the mean. This simplifies to:
|
||||
\[\text{Var}[X] = E[X^2] - E[X]^2\] \textbf{Note:} Generally,
|
||||
\[E[X^2] \ne E[X]^2\]
|
||||
|
||||
The standard deviation, \(\sigma\), is given by:
|
||||
\[\sigma = \sqrt{\text{Var}[X]}\]
|
||||
|
||||
\textbf{Note}: The variance is a measure of uncertainty (spread) in the
|
||||
data.
|
||||
|
||||
\hypertarget{example-3}{%
|
||||
\subsubsection{Example}\label{example-3}}
|
||||
|
||||
The weekly demand for a drinking water product in thousands of liters
|
||||
from a local chain of efficiency stores is a continuous random variable,
|
||||
\(X\), having the probability density: \[F(x) = \begin{cases}
|
||||
2(x-1) & 1 < x < 2 \\
|
||||
0 & \text{elsewhere}
|
||||
\end{cases}\]
|
||||
|
||||
Find the expected value:
|
||||
\[E[X] = \int\limits_1^2 x (2(x-1)) dx = 2\int\limits_1^2 (x^2 - x)dx\]
|
||||
\[E[X] = 2\left[{1\over3}x^3 - {1\over2}x^2 \Big|_1^2 \right] = {5\over3}\]
|
||||
|
||||
Find the variance: \[\text{Var}[X] = E[X^2] - E[X]^2\]
|
||||
\[E[X^2] = \int\limits_1^2 2x^2(x-1)dx = 2\int\limits_1^2 (x^3 - x^2)dx\]
|
||||
\[E[X^2] = {17\over6}\]
|
||||
\[\text{Var}[X] = {17\over6} - \left({5\over3}\right)^2 = {1\over18}\]
|
||||
|
||||
Find the standard deviation:
|
||||
\[\sigma = \sqrt{\text{Var}[X]} = {1\over3\sqrt{2}} = {\sqrt{2}\over6}\]
|
||||
|
||||
\hypertarget{example-4}{%
|
||||
\subsubsection{Example}\label{example-4}}
|
||||
|
||||
The mean and variance are useful when comparing two or more
|
||||
distributions.
|
||||
|
||||
\begin{longtable}[]{@{}lll@{}}
|
||||
\toprule()
|
||||
& Plan 1 & Plan 2 \\
|
||||
\midrule()
|
||||
\endhead
|
||||
Avg Score Improvement & \(+17\) & \(+15\) \\
|
||||
Standard deviation & \(\pm8\) & \(\pm2\) \\
|
||||
\bottomrule()
|
||||
\end{longtable}
|
||||
|
||||
\hypertarget{theorem}{%
|
||||
\subsubsection{Theorem}\label{theorem}}
|
||||
|
||||
If \(X\) has variance, \(\text{Var}[X]\), then
|
||||
\(\text{Var}[aX + b] = a^2\text{Var}[X]\).
|
||||
|
||||
\hypertarget{example-5}{%
|
||||
\subsubsection{Example}\label{example-5}}
|
||||
|
||||
The length of time, in minutes, for an airplane to obtain clearance at a
|
||||
certain airport is a random variable, \(Y = 3X - 2\), where \(X\) has
|
||||
the density: \[F(x) = \begin{cases}
|
||||
{1\over4} e^{x/4} & x > 0 \\
|
||||
0 & \text{elsewhere}
|
||||
\end{cases}\]
|
||||
|
||||
\[E[X] = 4\] \[\text{Var}[X] = 16\]
|
||||
|
||||
Find \(E[Y]\): \[E[Y] = E[3X-2] = 3E[X] - 2 = 10\]
|
||||
\[\text{Var}[Y] = 3^2\text{Var}[X] = 144\]
|
||||
\[\sigma = \sqrt{\text{Var}[Y]} = 12\]
|
||||
|
||||
\hypertarget{the-exponential-distribution}{%
|
||||
\subsection{The Exponential
|
||||
Distribution}\label{the-exponential-distribution}}
|
||||
|
||||
The continuous random variable, \(X\), has an exponential distribution
|
||||
with parameter \(\beta\) if its density function is given by:
|
||||
\[F(x) = \begin{cases}
|
||||
{1\over\beta}e^{-x/\beta} & x > 0 \\
|
||||
0 & \text{elsewhere}
|
||||
\end{cases}\]
|
||||
|
||||
Where \(\beta > 0\).
|
||||
|
||||
\[E[X] = \beta\]
|
||||
\[E[X] = \int\limits_0^{\infty} x{1\over\beta}e^{-x/\beta} dx\]
|
||||
|
||||
Aside: \[\Gamma(Z) = \int\limits_0^\infty x^{Z - 1}e^{-x}dx\] Where
|
||||
\(\Gamma(Z) = (Z - 1)!\)
|
||||
|
||||
\[E[X] = \beta \int\limits_0^\infty \left({x\over\beta}\right)^{(2-1)} e^{-x/\beta} \left({dx\over\beta}\right) = \beta\Gamma(2)\]
|
||||
\[E[X] = \beta(2-1)! = \beta\]
|
||||
|
||||
\[\text{Var}[X] = E[X^2] - E[X]^2\]
|
||||
\[E[X^2] = \int\limits_0^\infty x^2{1\over\beta}e^{-x/\beta}dx = \beta^2 \int\limits_0^\infty \left({x\over\beta}\right)^{(2-1)} e^{-x/\beta} \left({dx\over\beta}\right)\]
|
||||
\[E[X^2] = \beta^2\Gamma(3) = 2\beta^2\]
|
||||
\[\text{Var}[X] = 2\beta^2 - \beta^2 = \beta^2\]
|
||||
|
||||
\hypertarget{application}{%
|
||||
\paragraph{Application}\label{application}}
|
||||
|
||||
Reliability analysis: the time to failure of a certain electronic
|
||||
component can be modeled by an exponential distribution.
|
||||
|
||||
\hypertarget{example-6}{%
|
||||
\subsubsection{Example}\label{example-6}}
|
||||
|
||||
Let \(T\) be the random variable which measures the time to failure of a
|
||||
certain electronic component. Suppose \(T\) has an exponential
|
||||
distribution with \(\beta = 5\).
|
||||
|
||||
\[F(x) = \begin{cases}
|
||||
{1\over5}e^{-x/5} & x > 0 \\
|
||||
0 & \text{elsewhere}
|
||||
\end{cases}\]
|
||||
|
||||
If 6 of these components are in use, what is the probability that
|
||||
exactly 3 components are still functioning at the end of 8 years?
|
||||
|
||||
What is the probability that an individual component is still
|
||||
functioning after 8 years?
|
||||
|
||||
\[P(T > 8) = \int\limits_8^\infty {1\over5}e^{-x/5}dx \approx 0.2\]
|
||||
|
||||
\[{6 \choose 3}(0.2)^3(0.8)^3 = 0.08192\]
|
||||
|
||||
\begin{Shaded}
|
||||
\begin{Highlighting}[]
|
||||
\OperatorTok{\textgreater{}\textgreater{}\textgreater{}} \ImportTok{from}\NormalTok{ math }\ImportTok{import}\NormalTok{ comb}
|
||||
\OperatorTok{\textgreater{}\textgreater{}\textgreater{}}\NormalTok{ comb(}\DecValTok{6}\NormalTok{,}\DecValTok{3}\NormalTok{) }\OperatorTok{*} \FloatTok{0.2}\OperatorTok{**}\DecValTok{3} \OperatorTok{*} \FloatTok{0.8}\OperatorTok{**}\DecValTok{3}
|
||||
\FloatTok{0.08192000000000003}
|
||||
\end{Highlighting}
|
||||
\end{Shaded}
|
||||
|
||||
\hypertarget{the-normal-distribution}{%
|
||||
\subsection{The Normal Distribution}\label{the-normal-distribution}}
|
||||
|
||||
The most important continuous probability distribution in the field of
|
||||
statistics is the normal distribution. It is characterized by 2
|
||||
parameters, the mean, \(\mu\), and the variance, \(\sigma^2\).
|
||||
\[\text{mean} = \text{median} = \text{mode}\]
|
||||
|
||||
\[F(x|\mu,\sigma^2) = {1 \over \sqrt{2\pi} \sigma^2} e^{\left({1 \over 2\sigma^2}(x-\mu)^2\right)}\]
|
||||
\[E[X] = \mu\] \[\text{Var}[X] = \sigma^2\]
|
||||
|
||||
For a normal curve:
|
||||
\[P(x_1 < x < x_2) = \int\limits_{x_1}^{x_2} F(x)dx\]
|
||||
|
||||
\hypertarget{definition-2}{%
|
||||
\subsubsection{Definition}\label{definition-2}}
|
||||
|
||||
The distribution of a normal variable with mean 0 and variance 1 is
|
||||
called a standard normal distribution.
|
||||
|
||||
The transformation of any random variable, \(X\) into a standard normal
|
||||
variable, \(Z\): \[Z = {X - \mu \over \sigma}\]
|
||||
|
||||
\hypertarget{example-7}{%
|
||||
\subsubsection{Example}\label{example-7}}
|
||||
|
||||
Given a normal distribution with mean \(\mu = 30\) and standard
|
||||
deviation, \(\sigma = 6\), find the normal curve area to the right of
|
||||
\(x = 17\).
|
||||
|
||||
Transform to standard normal. \[Z = {17 - 30 \over 6} = -2.16\]
|
||||
|
||||
That is, \(x = 17\) on a normal distribution with \(\mu = 30\) and
|
||||
\(\sigma = 6\) is equivalent to \(Z=-2.16\) on a normal distribution
|
||||
with \(\mu = 0\) and \(\sigma = 1\).
|
||||
|
||||
\[P(X > 17) = P(Z > -2.16)\]
|
||||
|
||||
\[P(Z > -2.16) = 1 -P(Z \le -2.16) = 0.9846\]
|
||||
|
||||
\begin{Shaded}
|
||||
\begin{Highlighting}[]
|
||||
\OperatorTok{\textgreater{}\textgreater{}\textgreater{}} \ImportTok{from}\NormalTok{ scipy.stats }\ImportTok{import}\NormalTok{ norm}
|
||||
\OperatorTok{\textgreater{}\textgreater{}\textgreater{}}\NormalTok{ norm.cdf(}\OperatorTok{{-}}\FloatTok{2.16}\NormalTok{)}
|
||||
\FloatTok{0.015386334783925445}
|
||||
\end{Highlighting}
|
||||
\end{Shaded}
|
||||
|
||||
\hypertarget{example-8}{%
|
||||
\subsubsection{Example}\label{example-8}}
|
||||
|
||||
The finished inside diameter of a piston ring is normally distributed
|
||||
with mean, \(\mu = 10\){[}cm{]}, and standard deviation,
|
||||
\(\sigma = 0.03\){[}cm{]}.
|
||||
|
||||
What is the probability that a piston ring will have inside diameter
|
||||
between 9.97{[}cm{]} and 10.03{[}cm{]}?
|
||||
|
||||
\[Z_1 = {9.97 - 10 \over 0.03} = -1\] \[Z_2 = {10.03 - 10 \over 3} = 1\]
|
||||
\[P(9.97 < x < 10.03) = 0.68\]
|
||||
|
||||
\begin{Shaded}
|
||||
\begin{Highlighting}[]
|
||||
\OperatorTok{\textgreater{}\textgreater{}\textgreater{}} \ImportTok{from}\NormalTok{ scipy.stats }\ImportTok{import}\NormalTok{ norm}
|
||||
\OperatorTok{\textgreater{}\textgreater{}\textgreater{}}\NormalTok{ norm.cdf(}\DecValTok{1}\NormalTok{) }\OperatorTok{{-}}\NormalTok{ norm.cdf(}\OperatorTok{{-}}\DecValTok{1}\NormalTok{)}
|
||||
\FloatTok{0.6826894921370859}
|
||||
\end{Highlighting}
|
||||
\end{Shaded}
|
@ -0,0 +1,351 @@
|
||||
# Chapter 5
|
||||
|
||||
## Statistical Inference
|
||||
Statistical inference is the process of drawing conclusions about the entire population based on information from a sample.
|
||||
|
||||
### Parameter vs. Statistic
|
||||
A parameter is a number that summarizes data from an entire population.
|
||||
|
||||
A statistic is a number that summarizes data from a sample.
|
||||
|
||||
| |parameter|statistic
|
||||
|-|-|-
|
||||
|mean|$\mu$| $\bar{x}$
|
||||
|standard deviation| $\sigma$ | $s$
|
||||
|variance| $\sigma^2$ | $s^2$
|
||||
|
||||
### Example
|
||||
Suppose you were interested in the number of hours that Rowan students spend studying on Sundays. You take a random sample of $n = 100$ students and the average time they study on Sunday is $\bar{x}= 3.2$[hrs].
|
||||
|
||||
We use $\bar{x} = 3.2$[hrs] as our best estimate for $\mu$.
|
||||
|
||||
### Variability of Sample Statistics
|
||||
We normally think of a parameter as a fixed value. Sample statistics vary from sample to sample.
|
||||
|
||||
|
||||
### Sampling Distribution
|
||||
A sampling distribution is the distribution of sample statistics computed for different samples of the same sample size from the same population.
|
||||
|
||||
The mean of the sample means is $\mu$. For a random sample of size, $n$, the standard error is given by:
|
||||
$$\text{var}(\bar{x}) = {\sigma^2 \over n}$$
|
||||
|
||||
### Central Limit Theorem
|
||||
If $\bar{x}$ is the mean of a random sample of size, $n$, taken from a population with mean, $\mu$, and finite variance, $\sigma^2$, then the limiting form of the distribution.
|
||||
$$z = {\sqrt{n} (\bar{x} - \mu )\over \sigma}$$
|
||||
|
||||
As $n \to \infty$, is the standard normal distribution. This generally holds for $n \ge 30$. If $n < 30$, the approximation is good so long as the population is not too different from a normal distribution.
|
||||
|
||||
### Unbiased Estimator
|
||||
A statistic, $\hat{\theta}$, is said to be an unbiased estimator of the parameter, $\theta$, if:
|
||||
$$E[\hat{\theta}] = \theta$$
|
||||
or
|
||||
$$E[\hat{\theta} - \theta] =0$$
|
||||
|
||||
The mean:
|
||||
$$\bar{x} = {1\over n} \sum_{i=1}^{n} x_i$$
|
||||
is an unbiased estimator of $\mu$.
|
||||
|
||||
Proof:
|
||||
$$E[\bar{x}] = E\left[ {1\over n} \sum_{i=1}^n x_i\right]$$
|
||||
$$= {1\over n} E[x_1 + x_2 + x_3 + \cdots + x_n]$$
|
||||
$$= {1\over n} \left[ E[x_1] + E[x_2] + \cdots + E[x_n]\right]$$
|
||||
$$= {1\over n} [\mu + \mu + \cdots + \mu]$$
|
||||
$$= {1\over n} [n\mu] = \mu$$
|
||||
|
||||
### Confidence Interval for $\mu$ if $\sigma$ is known:
|
||||
If our sample size is "large", then the CLT tells us that:
|
||||
$${\sqrt{n} (\bar{x} - \mu) \over \sigma} \sim N(0,1) \text{ as } n \to \infty$$
|
||||
|
||||
$$1 - \alpha = P(-z_{\alpha \over 2} \le {\bar{x} - \mu \over \sigma/\sqrt{n}} \le z_{\alpha \over2}$$
|
||||
|
||||
A ($1 - \alpha$)% confidence interval for $\mu$ is:
|
||||
$$\bar{x} \pm z_{\alpha \over 2} {\sigma \over \sqrt{n}}$$
|
||||
|
||||
90% CI: $z_{\alpha \over 2} = 1.645$
|
||||
|
||||
95% CI: $z_{\alpha \over 2} = 1.96$$
|
||||
|
||||
99% CI: $z_{\alpha \over 2} = 2.576$
|
||||
|
||||
### Example
|
||||
In a random sample of 75 Rowan students, the sample mean height was 67 inches. Suppose the population standard deviation is known to be $\sigma = 7$ inches. Construct a 95% confidence interval for the mean height of *all* rowan students.
|
||||
|
||||
$$\bar{x} \pm z_{\alpha \over 2} {\sigma \over \sqrt{n}}$$
|
||||
$$\bar{x} = 67$$
|
||||
$$z_{\alpha \over 2} = 1.96$$
|
||||
$$\sigma = 7$$
|
||||
$$n = 75$$
|
||||
|
||||
A 95% CI for $\mu$:
|
||||
$$67 \pm 1.96 \left({7\over\sqrt{75}}\right) = (65.4, 68.6)$$
|
||||
|
||||
#### Interpretation
|
||||
95% confident that the mean height of all Rowan students is somewhere between 65.4 and 68.6 inches.
|
||||
|
||||
From the sample, we found that $\bar{x} = 67$ inches. Using the confidence interval, we are saying that we are 95% confident that $\mu$ is somewhere between 65.4 and 68.6 inches.
|
||||
|
||||
A limitation of $z$ confidence interval is that $\sigma$ is unlikely to be known.
|
||||
|
||||
|
||||
### Confidence interval for $\mu$ if $\sigma$ is unknown:
|
||||
If $\sigma$ is unknown, we then estimate the standard error, ${\sigma \over \sqrt{n}}$ as ${s \over \sqrt{n}}$.
|
||||
|
||||
When we estimate the standard error, the distribution is not normal. Instead, it follows a t-distribution with n-1 degrees of freedom. The new distribution is given as:
|
||||
$${\bar{x} - \mu \over {s \over \sqrt{n}}}$$
|
||||
|
||||
A ($1 - \alpha$)% confidence interval for $\mu$ when $\sigma$ is unknown is:
|
||||
$$\bar{x} \pm t^* {s\over \sqrt{n}}$$
|
||||
|
||||
Where $t^*$ is an end point chosen from the t-distribution. $t^*$ varies based on sample size and desired confidence level.
|
||||
|
||||
### Example
|
||||
A research engineer for a time manufacturer is investigating tire life for a new rubber compound and has built 115 tires and tested them to end-of-life in a road test. The sample mean and standard deviation are 60139.7, and 3645.94 kilometers.
|
||||
|
||||
Find a 90% confidence interval for the mean life of all such tires.
|
||||
$$\bar{x} \pm t^* {s\over\sqrt{n}}$$
|
||||
$$\bar{x} = 60139.7$$
|
||||
$$s = 3645.94$$
|
||||
$$n = 115$$
|
||||
$$t^* = \texttt{t\_crit\_value(115, 0.90)} = 1.658$$
|
||||
$$60139.7 \pm 1.658 {3645.94 \over \sqrt{115}} = (59567.1, 60703.3)$$
|
||||
|
||||
### Width of a Confidence Interval
|
||||
$$\bar{x} \pm t_{\alpha \over 2} {s \over \sqrt{n}}$$
|
||||
As sample size increases the width of the confidence interval decreases, and $\bar{x}$ becomes a better approximation of $\mu$.
|
||||
$$\lim_{n\to\infty} {s \over \sqrt{n}} = 0$$
|
||||
$$\lim_{n\to\infty} P(|\bar{x} - \mu| < \varepsilon) = 1$$
|
||||
Where $\varepsilon > 0$.
|
||||
|
||||
### One-Sided Confidence Intervals
|
||||
$$\left(-\infty, \bar{x} + t_\alpha {s \over \sqrt{n}}\right)$$
|
||||
|
||||
### Confidence Intervals in Python
|
||||
```python
|
||||
import numpy as np
|
||||
import matplotlib.pyplot as plt
|
||||
import seaborn as sns
|
||||
import scipy.stats
|
||||
|
||||
conf_levels = []
|
||||
iterations = 100
|
||||
|
||||
def tvalue(sample_size, conf_level):
|
||||
return stat.t.ppf(1 - (1 - conf_level)/2, sample_size - 1)
|
||||
|
||||
for i in range(iterations)
|
||||
sample = np.random.chisquare(df=10, size=100)
|
||||
sample_mean = np.mean(sample)
|
||||
std = np.std(sample)
|
||||
t_value = tvalue(100, .95)
|
||||
lb = sample_mean - t_value*(std / np.sqrt(100))
|
||||
ub = sample_mean + t_value*(std / np.sqrt(100))
|
||||
conf_levels.append((lb, ub))
|
||||
|
||||
plt.figure(figsize=(15,5))
|
||||
|
||||
for j, (lb, ub) in enumerate(conf_levels):
|
||||
if 10 < lb or 10 > ub:
|
||||
plt.plot([j,j], [lb,ub], 'ro-', color='red')
|
||||
else:
|
||||
plt.plot([j,j], [lb,ub], 'ro-', color='green')
|
||||
|
||||
plt.show()
|
||||
```
|
||||

|
||||
|
||||
## Hypothesis Testing
|
||||
Many problems require that we decide whether to accept or reject a statement about some parameter.
|
||||
|
||||
##### Hypothesis
|
||||
A claim that we want to test or investigate
|
||||
|
||||
##### Hypothesis Test
|
||||
A statistical test that is used to determine whether results from a sample are convincing enough to allow us to conclude something about the population.
|
||||
|
||||
Use sample evidence to back up claims about a population
|
||||
|
||||
##### Null Hypothesis
|
||||
The claim that there is no effect or no difference $(H_0)$.
|
||||
|
||||
##### Alternative Hypothesis
|
||||
The claim for which we seek evidence $(H_a)$.
|
||||
|
||||
#### Using $H_0$ and $H_a$
|
||||
Does the average Rowan student spend more than $300 each semester on books?
|
||||
|
||||
In a sample of 226 Rowan students, the mean cost of a students textbook was $344 with a standard deviation of $106.
|
||||
|
||||
$H_0$: $\mu = 300$.
|
||||
|
||||
$H_a$: $\mu > 300$.
|
||||
|
||||
$H_0$ and $H_a$ are statements about population parameters, not sample statistics.
|
||||
|
||||
In general, the null hypothesis is a statement of equality $(=)$, while the alternative hypothesis is a statement of inequality $(<, >, \ne)$.
|
||||
|
||||
#### Possible outcomes of a hypothesis test
|
||||
1. Reject the null hypothesis
|
||||
- Rejecting $H_0$ means we have enough evidence to support the alternative hypothesis
|
||||
1. Fail to reject the null hypothesis
|
||||
- Not enough evidence to support the alternative hypothesis
|
||||
|
||||
### Figuring Out Whether Sample Data is Supported
|
||||
If we assume that the null hypothesis is true, what is the probability of observing sample data that is as extreme or more extreme than what we observed.
|
||||
|
||||
In the Rowan example, we found that $\bar{x} = 344$.
|
||||
|
||||
### One-Sample T-test for a Mean
|
||||
To test a hypothesis regarding a single mean, there are two main parametric options:
|
||||
1. z-test
|
||||
1. t-test
|
||||
|
||||
The z-test requires knowledge of the population standard deviation. Since $\sigma$ is unlikely to be known, we will use a t-test.
|
||||
|
||||
To test $H_0$: $\mu = \mu_0$ against its alternative $H_a$: $\mu \ne \mu_0$, use the t-statistic.
|
||||
|
||||
$$t^* = {\bar{x} - \mu_0 \over {s \over \sqrt{n}}}$$
|
||||
|
||||
##### P-Value
|
||||
A measure of inconsistency between the null hypothesis and the sample data.
|
||||
|
||||
##### Significance Level $(\alpha)$
|
||||
$\alpha$ for a test of hypothesis is a boundary below which we conclude that a p-value shows statistically significant evidence against the null.
|
||||
|
||||
Common $\alpha$ levels are 0.01, 0.05, 0.10.
|
||||
|
||||
The lower the $\alpha$, the stronger the evidence required to reject $H_0$. If the p-value is less than $\alpha$, reject $H_0$, but if the p-value is greater than $\alpha$, fail to reject $H_0$.
|
||||
|
||||
#### Steps of a Hypothesis Test
|
||||
1. State the $H_0$ and $H_a$
|
||||
1. Calculate the test statistic
|
||||
1. Find the p-value
|
||||
1. Reject or fail to reject $H_0$
|
||||
1. Write conclusion in the context of the problem
|
||||
|
||||
### Example
|
||||
A researcher is interested in testing a particular brand of batteries and whether its battery life exceeds 40 hours.
|
||||
|
||||
A random sample of $n=70$ batteries has a mean life of $\bar{x} = 40.5$ hours with $s = 1.75$ Let $\alpha = 0.05$.
|
||||
|
||||
$H_0$: $\mu = 40$
|
||||
|
||||
$H_a$ $\mu > 40$
|
||||
|
||||
$$t^* = {\bar{x} - \mu_0 \over {s \over \sqrt{n}}}$$
|
||||
$$t^* = {40.5 - 40 \over {1.75 \over \sqrt{70}}} = 2.39$$
|
||||
|
||||
Find the p-value:
|
||||
$$P(t_{\alpha \over 2} \ge |t^*|) = 0.0097$$
|
||||
```python
|
||||
>>> from scipy.stats import t
|
||||
|
||||
>>> t = 2.39 # The t-score
|
||||
>>> s = 70 # The sample size
|
||||
|
||||
>>> t.sf(abs(t), s)
|
||||
0.009772027372500908
|
||||
```
|
||||
|
||||
If in fact $H_0$ is true, the probability of observing a test statistic that is as extreme or more extreme than $t^* = 2.39$ is about $0.0097$. That is to say, the sample is very unlikely to occur under $H_0$. Since the p-value is less than $\alpha$, $H_0$ is rejected.
|
||||
|
||||
Sample evidence suggests that the mean battery life of this particular brand exceeds 40 hours.
|
||||
|
||||
##### Type 1 Error
|
||||
When $H_0$ is rejected despite it being true.
|
||||
|
||||
The probability that a type 1 error occurs is $\alpha$
|
||||
|
||||
##### Type 2 Error
|
||||
When $H_0$ is not rejected despite it being false.
|
||||
|
||||
### NOTE:
|
||||
Our group of subjects should be representative of the entire population of interests.
|
||||
|
||||
Because we cannot impose an experiment on an entire population, we are often forced to examine a small, and we hope that the sample statistics, $\bar{x}$ and $s^2$, are good estimates of the population parameters, $\mu$ and $\sigma^2$.
|
||||
|
||||
### Example
|
||||
The effects of caffeine on the body have been well studied. In one experiment, a group of 20 male college students were trained in a particular tapping movement and to tap a rapid rate. They were randomly divided into caffeine and non-caffeine groups and given approximately 2 cups of coffee (Either 200[mg] of caffeine or decaf). After a two hour period, the tapping rate was measured.
|
||||
|
||||
The population of interest is male college-aged students.
|
||||
|
||||
The question of interest: is the mean tap rate of the caffeinated group different than that of the non-caffeinated group.
|
||||
|
||||
Let $\mu_c$ be the mean of the caffeinated group, and $\mu_d$ be the mean of the caffeinated group.
|
||||
|
||||
$H_0$: $\mu_c = \mu_d$
|
||||
|
||||
$H_a$: $\mu_c \ne \mu_d$
|
||||
|
||||
## Two-Sample T-Test
|
||||
To test:
|
||||
|
||||
$H_0$: $\mu_1 = \mu_2$
|
||||
|
||||
$H_a$: $\mu_1 \ne \mu_2$
|
||||
|
||||
Use the following statistic:
|
||||
$$t^* = {(\bar{x}_1 - \bar{x}_2) - (\mu_1 - \mu_2) \over s_p \sqrt{{1\over n_1} + {1\over n_2}}}$$
|
||||
Where:
|
||||
$$s_p^2 = {(n_1 -1)s_1^2 + (n_2 - 1)s_2^2 \over n_1 + n_2 -2}$$
|
||||
Where $t^*$ follows a t-distribution with $n_1 + n_2 -2$ degrees of freedom under $H_0$. Thus, the p-value is $P(t_{n_1 + n_2 -2} \ge |t^*|)$ for a one sided test, and twice that for a two sided test.
|
||||
|
||||
##### Assumptions:
|
||||
The two populations are independently normally distributed with the same variance.
|
||||
|
||||
### Example
|
||||
$H_0$: $\mu_c = \mu_d$
|
||||
|
||||
$H_a$: $\mu_c = \mu_d$
|
||||
|
||||
$$s_p^2 = {(n_1 -1)s_1^2 + (n_2 - 1)s_2^2 \over n_1 + n_2 -2}$$
|
||||
$$s_p^2 = {(10 -1)(5.73) + (10 - 1)(4.9) \over 18} = 5.315$$
|
||||
$$s_p = \sqrt{5.315}$$
|
||||
|
||||
Find the p-value:
|
||||
$$2P(t_{n_1 + n_2 - 2} \ge |3.394|) = 0.00326$$
|
||||
Since the p-value $< \alpha$, we reject $H_0$.
|
||||
|
||||
Sample evidence suggests that the mean tap rate for the caffeinated group is different than that for the con-caffeinated group.
|
||||
|
||||
### Example
|
||||
The thickness of a plastic film in mils on a substrate material is thought to be influenced by the temperature at which the coating is applied. A completely randomized experiment is carried out. 11 substrates are coated at 125$^\circ$F, resulting in sample mean coating thickness of $\bar{x}_1 = 103.5$, and sample standard deviation of $s_1 = 10.2$. Another 13 substrates are coated at 150$^\circ$F, where $\bar{x}_2 = 99.7$ and $s_2 = 15.1$. It is suspected that raising the process temperature would reduce the mean coating thickness. Does the data support this claim? Use $\alpha = 0.01$.
|
||||
|
||||
|| 125$^\circ$F | 150$^\circ$F |
|
||||
|-|-|-
|
||||
|$\bar{x}$| 103.5 | 99.7
|
||||
|$s$| 10.2 | 15.1
|
||||
|$n$| 11 | 13
|
||||
|
||||
$H_0$: $\mu_1 = \mu_2$
|
||||
|
||||
$H_a$: $\mu_1 < \mu_2$
|
||||
|
||||
$$t^* = {(\bar{x}_1 - \bar{x}_2) \over s_p \sqrt{{1\over n_1} + {1\over n_2}}}$$
|
||||
$$s_p^2 = {(11 - 1)(10.2)^2 + (13-1)(15.1)^2 \over 11 + 13 - 2} = 171.66$$
|
||||
$$s_p = 13.1$$
|
||||
$$t^* = {(99.7 - 103.5) \over 13.1 \sqrt{{1\over11} + {1\over13}}} = -0.71$$
|
||||
|
||||
Find the p-value:
|
||||
$$P(t_{n_1 + n_2 - 2} > |-0.71|) = 0.243$$
|
||||
Since the p-value is greater than $\alpha$, we fail to reject $H_0$. That is to say sample evidence does not suggest that raising the process temperature would reduce the mean coating thickness.
|
||||
|
||||
## Practical vs. Statistical Significance
|
||||
More samples is not always better.
|
||||
* Waste of resources
|
||||
* Statistical significance $\ne$ practical significance
|
||||
|
||||
### Example
|
||||
Consider an SAT score improvement study.
|
||||
|
||||
$600 study plan: $x_{11}, x_{12}, \cdots, x_{1n}$
|
||||
|
||||
Traditional study plan: $x_{21}, x_{22}, \cdots, x_{2n}$
|
||||
|
||||
Test for
|
||||
$H_0$: $\mu_1 = \mu_2$
|
||||
|
||||
$H_a$: $\mu_1 \ne \mu_2$
|
||||
|
||||
Test statistic:
|
||||
$$t^* = {\bar{x}_1 - \bar{x}_2 \over s_p \sqrt{{1\over n_1} + {1\over n_2}}}$$
|
||||
Suppose that $\mu_1 - \mu_2 = 1$ point. When $n \to \infty$, $\bar{x}_1 - \bar{x}_2 \xrightarrow{p} \mu_1 - \mu_2$, $s_p^2 \to \sigma^2$ as $n\to \infty$.
|
@ -0,0 +1,548 @@
|
||||
\hypertarget{chapter-5}{%
|
||||
\section{Chapter 5}\label{chapter-5}}
|
||||
|
||||
\hypertarget{statistical-inference}{%
|
||||
\subsection{Statistical Inference}\label{statistical-inference}}
|
||||
|
||||
Statistical inference is the process of drawing conclusions about the
|
||||
entire population based on information from a sample.
|
||||
|
||||
\hypertarget{parameter-vs.-statistic}{%
|
||||
\subsubsection{Parameter vs.~Statistic}\label{parameter-vs.-statistic}}
|
||||
|
||||
A parameter is a number that summarizes data from an entire population.
|
||||
|
||||
A statistic is a number that summarizes data from a sample.
|
||||
|
||||
\begin{longtable}[]{@{}lll@{}}
|
||||
\toprule()
|
||||
& parameter & statistic \\
|
||||
\midrule()
|
||||
\endhead
|
||||
mean & \(\mu\) & \(\bar{x}\) \\
|
||||
standard deviation & \(\sigma\) & \(s\) \\
|
||||
variance & \(\sigma^2\) & \(s^2\) \\
|
||||
\bottomrule()
|
||||
\end{longtable}
|
||||
|
||||
\hypertarget{example}{%
|
||||
\subsubsection{Example}\label{example}}
|
||||
|
||||
Suppose you were interested in the number of hours that Rowan students
|
||||
spend studying on Sundays. You take a random sample of \(n = 100\)
|
||||
students and the average time they study on Sunday is
|
||||
\(\bar{x}= 3.2\){[}hrs{]}.
|
||||
|
||||
We use \(\bar{x} = 3.2\){[}hrs{]} as our best estimate for \(\mu\).
|
||||
|
||||
\hypertarget{variability-of-sample-statistics}{%
|
||||
\subsubsection{Variability of Sample
|
||||
Statistics}\label{variability-of-sample-statistics}}
|
||||
|
||||
We normally think of a parameter as a fixed value. Sample statistics
|
||||
vary from sample to sample.
|
||||
|
||||
\hypertarget{sampling-distribution}{%
|
||||
\subsubsection{Sampling Distribution}\label{sampling-distribution}}
|
||||
|
||||
A sampling distribution is the distribution of sample statistics
|
||||
computed for different samples of the same sample size from the same
|
||||
population.
|
||||
|
||||
The mean of the sample means is \(\mu\). For a random sample of size,
|
||||
\(n\), the standard error is given by:
|
||||
\[\text{var}(\bar{x}) = {\sigma^2 \over n}\]
|
||||
|
||||
\hypertarget{central-limit-theorem}{%
|
||||
\subsubsection{Central Limit Theorem}\label{central-limit-theorem}}
|
||||
|
||||
If \(\bar{x}\) is the mean of a random sample of size, \(n\), taken from
|
||||
a population with mean, \(\mu\), and finite variance, \(\sigma^2\), then
|
||||
the limiting form of the distribution.
|
||||
\[z = {\sqrt{n} (\bar{x} - \mu )\over \sigma}\]
|
||||
|
||||
As \(n \to \infty\), is the standard normal distribution. This generally
|
||||
holds for \(n \ge 30\). If \(n < 30\), the approximation is good so long
|
||||
as the population is not too different from a normal distribution.
|
||||
|
||||
\hypertarget{unbiased-estimator}{%
|
||||
\subsubsection{Unbiased Estimator}\label{unbiased-estimator}}
|
||||
|
||||
A statistic, \(\hat{\theta}\), is said to be an unbiased estimator of
|
||||
the parameter, \(\theta\), if: \[E[\hat{\theta}] = \theta\] or
|
||||
\[E[\hat{\theta} - \theta] =0\]
|
||||
|
||||
The mean: \[\bar{x} = {1\over n} \sum_{i=1}^{n} x_i\] is an unbiased
|
||||
estimator of \(\mu\).
|
||||
|
||||
Proof: \[E[\bar{x}] = E\left[ {1\over n} \sum_{i=1}^n x_i\right]\]
|
||||
\[= {1\over n} E[x_1 + x_2 + x_3 + \cdots + x_n]\]
|
||||
\[= {1\over n} \left[ E[x_1] + E[x_2] + \cdots + E[x_n]\right]\]
|
||||
\[= {1\over n} [\mu + \mu + \cdots + \mu]\]
|
||||
\[= {1\over n} [n\mu] = \mu\]
|
||||
|
||||
\hypertarget{confidence-interval-for-mu-if-sigma-is-known}{%
|
||||
\subsubsection{\texorpdfstring{Confidence Interval for \(\mu\) if
|
||||
\(\sigma\) is
|
||||
known:}{Confidence Interval for \textbackslash mu if \textbackslash sigma is known:}}\label{confidence-interval-for-mu-if-sigma-is-known}}
|
||||
|
||||
If our sample size is ``large'', then the CLT tells us that:
|
||||
\[{\sqrt{n} (\bar{x} - \mu) \over \sigma} \sim N(0,1) \text{ as } n \to \infty\]
|
||||
|
||||
\[1 - \alpha = P(-z_{\alpha \over 2} \le {\bar{x} - \mu \over \sigma/\sqrt{n}} \le z_{\alpha \over2}\]
|
||||
|
||||
A (\(1 - \alpha\))\% confidence interval for \(\mu\) is:
|
||||
\[\bar{x} \pm z_{\alpha \over 2} {\sigma \over \sqrt{n}}\]
|
||||
|
||||
90\% CI: \(z_{\alpha \over 2} = 1.645\)
|
||||
|
||||
95\% CI: \(z_{\alpha \over 2} = 1.96\)\$
|
||||
|
||||
99\% CI: \(z_{\alpha \over 2} = 2.576\)
|
||||
|
||||
\hypertarget{example-1}{%
|
||||
\subsubsection{Example}\label{example-1}}
|
||||
|
||||
In a random sample of 75 Rowan students, the sample mean height was 67
|
||||
inches. Suppose the population standard deviation is known to be
|
||||
\(\sigma = 7\) inches. Construct a 95\% confidence interval for the mean
|
||||
height of \emph{all} rowan students.
|
||||
|
||||
\[\bar{x} \pm z_{\alpha \over 2} {\sigma \over \sqrt{n}}\]
|
||||
\[\bar{x} = 67\] \[z_{\alpha \over 2} = 1.96\] \[\sigma = 7\] \[n = 75\]
|
||||
|
||||
A 95\% CI for \(\mu\):
|
||||
\[67 \pm 1.96 \left({7\over\sqrt{75}}\right) = (65.4, 68.6)\]
|
||||
|
||||
\hypertarget{interpretation}{%
|
||||
\paragraph{Interpretation}\label{interpretation}}
|
||||
|
||||
95\% confident that the mean height of all Rowan students is somewhere
|
||||
between 65.4 and 68.6 inches.
|
||||
|
||||
From the sample, we found that \(\bar{x} = 67\) inches. Using the
|
||||
confidence interval, we are saying that we are 95\% confident that
|
||||
\(\mu\) is somewhere between 65.4 and 68.6 inches.
|
||||
|
||||
A limitation of \(z\) confidence interval is that \(\sigma\) is unlikely
|
||||
to be known.
|
||||
|
||||
\hypertarget{confidence-interval-for-mu-if-sigma-is-unknown}{%
|
||||
\subsubsection{\texorpdfstring{Confidence interval for \(\mu\) if
|
||||
\(\sigma\) is
|
||||
unknown:}{Confidence interval for \textbackslash mu if \textbackslash sigma is unknown:}}\label{confidence-interval-for-mu-if-sigma-is-unknown}}
|
||||
|
||||
If \(\sigma\) is unknown, we then estimate the standard error,
|
||||
\({\sigma \over \sqrt{n}}\) as \({s \over \sqrt{n}}\).
|
||||
|
||||
When we estimate the standard error, the distribution is not normal.
|
||||
Instead, it follows a t-distribution with n-1 degrees of freedom. The
|
||||
new distribution is given as:
|
||||
\[{\bar{x} - \mu \over {s \over \sqrt{n}}}\]
|
||||
|
||||
A (\(1 - \alpha\))\% confidence interval for \(\mu\) when \(\sigma\) is
|
||||
unknown is: \[\bar{x} \pm t^* {s\over \sqrt{n}}\]
|
||||
|
||||
Where \(t^*\) is an end point chosen from the t-distribution. \(t^*\)
|
||||
varies based on sample size and desired confidence level.
|
||||
|
||||
\hypertarget{example-2}{%
|
||||
\subsubsection{Example}\label{example-2}}
|
||||
|
||||
A research engineer for a time manufacturer is investigating tire life
|
||||
for a new rubber compound and has built 115 tires and tested them to
|
||||
end-of-life in a road test. The sample mean and standard deviation are
|
||||
60139.7, and 3645.94 kilometers.
|
||||
|
||||
Find a 90\% confidence interval for the mean life of all such tires.
|
||||
\[\bar{x} \pm t^* {s\over\sqrt{n}}\] \[\bar{x} = 60139.7\]
|
||||
\[s = 3645.94\] \[n = 115\]
|
||||
\[t^* = \texttt{t\_crit\_value(115, 0.90)} = 1.658\]
|
||||
\[60139.7 \pm 1.658 {3645.94 \over \sqrt{115}} = (59567.1, 60703.3)\]
|
||||
|
||||
\hypertarget{width-of-a-confidence-interval}{%
|
||||
\subsubsection{Width of a Confidence
|
||||
Interval}\label{width-of-a-confidence-interval}}
|
||||
|
||||
\[\bar{x} \pm t_{\alpha \over 2} {s \over \sqrt{n}}\] As sample size
|
||||
increases the width of the confidence interval decreases, and
|
||||
\(\bar{x}\) becomes a better approximation of \(\mu\).
|
||||
\[\lim_{n\to\infty} {s \over \sqrt{n}} = 0\]
|
||||
\[\lim_{n\to\infty} P(|\bar{x} - \mu| < \varepsilon) = 1\] Where
|
||||
\(\varepsilon > 0\).
|
||||
|
||||
\hypertarget{one-sided-confidence-intervals}{%
|
||||
\subsubsection{One-Sided Confidence
|
||||
Intervals}\label{one-sided-confidence-intervals}}
|
||||
|
||||
\[\left(-\infty, \bar{x} + t_\alpha {s \over \sqrt{n}}\right)\]
|
||||
|
||||
\hypertarget{confidence-intervals-in-python}{%
|
||||
\subsubsection{Confidence Intervals in
|
||||
Python}\label{confidence-intervals-in-python}}
|
||||
|
||||
\begin{Shaded}
|
||||
\begin{Highlighting}[]
|
||||
\ImportTok{import}\NormalTok{ numpy }\ImportTok{as}\NormalTok{ np}
|
||||
\ImportTok{import}\NormalTok{ matplotlib.pyplot }\ImportTok{as}\NormalTok{ plt}
|
||||
\ImportTok{import}\NormalTok{ seaborn }\ImportTok{as}\NormalTok{ sns}
|
||||
\ImportTok{import}\NormalTok{ scipy.stats}
|
||||
|
||||
\NormalTok{conf\_levels }\OperatorTok{=}\NormalTok{ []}
|
||||
\NormalTok{iterations }\OperatorTok{=} \DecValTok{100}
|
||||
|
||||
\KeywordTok{def}\NormalTok{ tvalue(sample\_size, conf\_level):}
|
||||
\ControlFlowTok{return}\NormalTok{ stat.t.ppf(}\DecValTok{1} \OperatorTok{{-}}\NormalTok{ (}\DecValTok{1} \OperatorTok{{-}}\NormalTok{ conf\_level)}\OperatorTok{/}\DecValTok{2}\NormalTok{, sample\_size }\OperatorTok{{-}} \DecValTok{1}\NormalTok{)}
|
||||
|
||||
\ControlFlowTok{for}\NormalTok{ i }\KeywordTok{in} \BuiltInTok{range}\NormalTok{(iterations)}
|
||||
\NormalTok{ sample }\OperatorTok{=}\NormalTok{ np.random.chisquare(df}\OperatorTok{=}\DecValTok{10}\NormalTok{, size}\OperatorTok{=}\DecValTok{100}\NormalTok{)}
|
||||
\NormalTok{ sample\_mean }\OperatorTok{=}\NormalTok{ np.mean(sample)}
|
||||
\NormalTok{ std }\OperatorTok{=}\NormalTok{ np.std(sample)}
|
||||
\NormalTok{ t\_value }\OperatorTok{=}\NormalTok{ tvalue(}\DecValTok{100}\NormalTok{, }\FloatTok{.95}\NormalTok{)}
|
||||
\NormalTok{ lb }\OperatorTok{=}\NormalTok{ sample\_mean }\OperatorTok{{-}}\NormalTok{ t\_value}\OperatorTok{*}\NormalTok{(std }\OperatorTok{/}\NormalTok{ np.sqrt(}\DecValTok{100}\NormalTok{))}
|
||||
\NormalTok{ ub }\OperatorTok{=}\NormalTok{ sample\_mean }\OperatorTok{+}\NormalTok{ t\_value}\OperatorTok{*}\NormalTok{(std }\OperatorTok{/}\NormalTok{ np.sqrt(}\DecValTok{100}\NormalTok{))}
|
||||
\NormalTok{ conf\_levels.append((lb, ub))}
|
||||
|
||||
\NormalTok{plt.figure(figsize}\OperatorTok{=}\NormalTok{(}\DecValTok{15}\NormalTok{,}\DecValTok{5}\NormalTok{))}
|
||||
|
||||
\ControlFlowTok{for}\NormalTok{ j, (lb, ub) }\KeywordTok{in} \BuiltInTok{enumerate}\NormalTok{(conf\_levels):}
|
||||
\ControlFlowTok{if} \DecValTok{10} \OperatorTok{\textless{}}\NormalTok{ lb }\KeywordTok{or} \DecValTok{10} \OperatorTok{\textgreater{}}\NormalTok{ ub:}
|
||||
\NormalTok{ plt.plot([j,j], [lb,ub], }\StringTok{\textquotesingle{}ro{-}\textquotesingle{}}\NormalTok{, color}\OperatorTok{=}\StringTok{\textquotesingle{}red\textquotesingle{}}\NormalTok{)}
|
||||
\ControlFlowTok{else}\NormalTok{:}
|
||||
\NormalTok{ plt.plot([j,j], [lb,ub], }\StringTok{\textquotesingle{}ro{-}\textquotesingle{}}\NormalTok{, color}\OperatorTok{=}\StringTok{\textquotesingle{}green\textquotesingle{}}\NormalTok{)}
|
||||
|
||||
\NormalTok{plt.show()}
|
||||
\end{Highlighting}
|
||||
\end{Shaded}
|
||||
|
||||
\includegraphics{ConfidenceInterval.png}
|
||||
|
||||
\hypertarget{hypothesis-testing}{%
|
||||
\subsection{Hypothesis Testing}\label{hypothesis-testing}}
|
||||
|
||||
Many problems require that we decide whether to accept or reject a
|
||||
statement about some parameter.
|
||||
|
||||
\hypertarget{hypothesis}{%
|
||||
\subparagraph{Hypothesis}\label{hypothesis}}
|
||||
|
||||
A claim that we want to test or investigate
|
||||
|
||||
\hypertarget{hypothesis-test}{%
|
||||
\subparagraph{Hypothesis Test}\label{hypothesis-test}}
|
||||
|
||||
A statistical test that is used to determine whether results from a
|
||||
sample are convincing enough to allow us to conclude something about the
|
||||
population.
|
||||
|
||||
Use sample evidence to back up claims about a population
|
||||
|
||||
\hypertarget{null-hypothesis}{%
|
||||
\subparagraph{Null Hypothesis}\label{null-hypothesis}}
|
||||
|
||||
The claim that there is no effect or no difference \((H_0)\).
|
||||
|
||||
\hypertarget{alternative-hypothesis}{%
|
||||
\subparagraph{Alternative Hypothesis}\label{alternative-hypothesis}}
|
||||
|
||||
The claim for which we seek evidence \((H_a)\).
|
||||
|
||||
\hypertarget{using-h_0-and-h_a}{%
|
||||
\paragraph{\texorpdfstring{Using \(H_0\) and
|
||||
\(H_a\)}{Using H\_0 and H\_a}}\label{using-h_0-and-h_a}}
|
||||
|
||||
Does the average Rowan student spend more than \$300 each semester on
|
||||
books?
|
||||
|
||||
In a sample of 226 Rowan students, the mean cost of a students textbook
|
||||
was \$344 with a standard deviation of \$106.
|
||||
|
||||
\(H_0\): \(\mu = 300\).
|
||||
|
||||
\(H_a\): \(\mu > 300\).
|
||||
|
||||
\(H_0\) and \(H_a\) are statements about population parameters, not
|
||||
sample statistics.
|
||||
|
||||
In general, the null hypothesis is a statement of equality \((=)\),
|
||||
while the alternative hypothesis is a statement of inequality
|
||||
\((<, >, \ne)\).
|
||||
|
||||
\hypertarget{possible-outcomes-of-a-hypothesis-test}{%
|
||||
\paragraph{Possible outcomes of a hypothesis
|
||||
test}\label{possible-outcomes-of-a-hypothesis-test}}
|
||||
|
||||
\begin{enumerate}
|
||||
\def\labelenumi{\arabic{enumi}.}
|
||||
\tightlist
|
||||
\item
|
||||
Reject the null hypothesis
|
||||
|
||||
\begin{itemize}
|
||||
\tightlist
|
||||
\item
|
||||
Rejecting \(H_0\) means we have enough evidence to support the
|
||||
alternative hypothesis
|
||||
\end{itemize}
|
||||
\item
|
||||
Fail to reject the null hypothesis
|
||||
|
||||
\begin{itemize}
|
||||
\tightlist
|
||||
\item
|
||||
Not enough evidence to support the alternative hypothesis
|
||||
\end{itemize}
|
||||
\end{enumerate}
|
||||
|
||||
\hypertarget{figuring-out-whether-sample-data-is-supported}{%
|
||||
\subsubsection{Figuring Out Whether Sample Data is
|
||||
Supported}\label{figuring-out-whether-sample-data-is-supported}}
|
||||
|
||||
If we assume that the null hypothesis is true, what is the probability
|
||||
of observing sample data that is as extreme or more extreme than what we
|
||||
observed.
|
||||
|
||||
In the Rowan example, we found that \(\bar{x} = 344\).
|
||||
|
||||
\hypertarget{one-sample-t-test-for-a-mean}{%
|
||||
\subsubsection{One-Sample T-test for a
|
||||
Mean}\label{one-sample-t-test-for-a-mean}}
|
||||
|
||||
To test a hypothesis regarding a single mean, there are two main
|
||||
parametric options: 1. z-test 1. t-test
|
||||
|
||||
The z-test requires knowledge of the population standard deviation.
|
||||
Since \(\sigma\) is unlikely to be known, we will use a t-test.
|
||||
|
||||
To test \(H_0\): \(\mu = \mu_0\) against its alternative \(H_a\):
|
||||
\(\mu \ne \mu_0\), use the t-statistic.
|
||||
|
||||
\[t^* = {\bar{x} - \mu_0 \over {s \over \sqrt{n}}}\]
|
||||
|
||||
\hypertarget{p-value}{%
|
||||
\subparagraph{P-Value}\label{p-value}}
|
||||
|
||||
A measure of inconsistency between the null hypothesis and the sample
|
||||
data.
|
||||
|
||||
\hypertarget{significance-level-alpha}{%
|
||||
\subparagraph{\texorpdfstring{Significance Level
|
||||
\((\alpha)\)}{Significance Level (\textbackslash alpha)}}\label{significance-level-alpha}}
|
||||
|
||||
\(\alpha\) for a test of hypothesis is a boundary below which we
|
||||
conclude that a p-value shows statistically significant evidence against
|
||||
the null.
|
||||
|
||||
Common \(\alpha\) levels are 0.01, 0.05, 0.10.
|
||||
|
||||
The lower the \(\alpha\), the stronger the evidence required to reject
|
||||
\(H_0\). If the p-value is less than \(\alpha\), reject \(H_0\), but if
|
||||
the p-value is greater than \(\alpha\), fail to reject \(H_0\).
|
||||
|
||||
\hypertarget{steps-of-a-hypothesis-test}{%
|
||||
\paragraph{Steps of a Hypothesis
|
||||
Test}\label{steps-of-a-hypothesis-test}}
|
||||
|
||||
\begin{enumerate}
|
||||
\def\labelenumi{\arabic{enumi}.}
|
||||
\tightlist
|
||||
\item
|
||||
State the \(H_0\) and \(H_a\)
|
||||
\item
|
||||
Calculate the test statistic
|
||||
\item
|
||||
Find the p-value
|
||||
\item
|
||||
Reject or fail to reject \(H_0\)
|
||||
\item
|
||||
Write conclusion in the context of the problem
|
||||
\end{enumerate}
|
||||
|
||||
\hypertarget{example-3}{%
|
||||
\subsubsection{Example}\label{example-3}}
|
||||
|
||||
A researcher is interested in testing a particular brand of batteries
|
||||
and whether its battery life exceeds 40 hours.
|
||||
|
||||
A random sample of \(n=70\) batteries has a mean life of
|
||||
\(\bar{x} = 40.5\) hours with \(s = 1.75\) Let \(\alpha = 0.05\).
|
||||
|
||||
\(H_0\): \(\mu = 40\)
|
||||
|
||||
\(H_a\) \(\mu > 40\)
|
||||
|
||||
\[t^* = {\bar{x} - \mu_0 \over {s \over \sqrt{n}}}\]
|
||||
\[t^* = {40.5 - 40 \over {1.75 \over \sqrt{70}}} = 2.39\]
|
||||
|
||||
Find the p-value: \[P(t_{\alpha \over 2} \ge |t^*|) = 0.0097\]
|
||||
|
||||
\begin{Shaded}
|
||||
\begin{Highlighting}[]
|
||||
\OperatorTok{\textgreater{}\textgreater{}\textgreater{}} \ImportTok{from}\NormalTok{ scipy.stats }\ImportTok{import}\NormalTok{ t}
|
||||
|
||||
\OperatorTok{\textgreater{}\textgreater{}\textgreater{}}\NormalTok{ t }\OperatorTok{=} \FloatTok{2.39} \CommentTok{\# The t{-}score}
|
||||
\OperatorTok{\textgreater{}\textgreater{}\textgreater{}}\NormalTok{ s }\OperatorTok{=} \DecValTok{70} \CommentTok{\# The sample size}
|
||||
|
||||
\OperatorTok{\textgreater{}\textgreater{}\textgreater{}}\NormalTok{ t.sf(}\BuiltInTok{abs}\NormalTok{(t), s)}
|
||||
\FloatTok{0.009772027372500908}
|
||||
\end{Highlighting}
|
||||
\end{Shaded}
|
||||
|
||||
If in fact \(H_0\) is true, the probability of observing a test
|
||||
statistic that is as extreme or more extreme than \(t^* = 2.39\) is
|
||||
about \(0.0097\). That is to say, the sample is very unlikely to occur
|
||||
under \(H_0\). Since the p-value is less than \(\alpha\), \(H_0\) is
|
||||
rejected.
|
||||
|
||||
Sample evidence suggests that the mean battery life of this particular
|
||||
brand exceeds 40 hours.
|
||||
|
||||
\hypertarget{type-1-error}{%
|
||||
\subparagraph{Type 1 Error}\label{type-1-error}}
|
||||
|
||||
When \(H_0\) is rejected despite it being true.
|
||||
|
||||
The probability that a type 1 error occurs is \(\alpha\)
|
||||
|
||||
\hypertarget{type-2-error}{%
|
||||
\subparagraph{Type 2 Error}\label{type-2-error}}
|
||||
|
||||
When \(H_0\) is not rejected despite it being false.
|
||||
|
||||
\hypertarget{note}{%
|
||||
\subsubsection{NOTE:}\label{note}}
|
||||
|
||||
Our group of subjects should be representative of the entire population
|
||||
of interests.
|
||||
|
||||
Because we cannot impose an experiment on an entire population, we are
|
||||
often forced to examine a small, and we hope that the sample statistics,
|
||||
\(\bar{x}\) and \(s^2\), are good estimates of the population
|
||||
parameters, \(\mu\) and \(\sigma^2\).
|
||||
|
||||
\hypertarget{example-4}{%
|
||||
\subsubsection{Example}\label{example-4}}
|
||||
|
||||
The effects of caffeine on the body have been well studied. In one
|
||||
experiment, a group of 20 male college students were trained in a
|
||||
particular tapping movement and to tap a rapid rate. They were randomly
|
||||
divided into caffeine and non-caffeine groups and given approximately 2
|
||||
cups of coffee (Either 200{[}mg{]} of caffeine or decaf). After a two
|
||||
hour period, the tapping rate was measured.
|
||||
|
||||
The population of interest is male college-aged students.
|
||||
|
||||
The question of interest: is the mean tap rate of the caffeinated group
|
||||
different than that of the non-caffeinated group.
|
||||
|
||||
Let \(\mu_c\) be the mean of the caffeinated group, and \(\mu_d\) be the
|
||||
mean of the caffeinated group.
|
||||
|
||||
\(H_0\): \(\mu_c = \mu_d\)
|
||||
|
||||
\(H_a\): \(\mu_c \ne \mu_d\)
|
||||
|
||||
\hypertarget{two-sample-t-test}{%
|
||||
\subsection{Two-Sample T-Test}\label{two-sample-t-test}}
|
||||
|
||||
To test:
|
||||
|
||||
\(H_0\): \(\mu_1 = \mu_2\)
|
||||
|
||||
\(H_a\): \(\mu_1 \ne \mu_2\)
|
||||
|
||||
Use the following statistic:
|
||||
\[t^* = {(\bar{x}_1 - \bar{x}_2) - (\mu_1 - \mu_2) \over s_p \sqrt{{1\over n_1} + {1\over n_2}}}\]
|
||||
Where: \[s_p^2 = {(n_1 -1)s_1^2 + (n_2 - 1)s_2^2 \over n_1 + n_2 -2}\]
|
||||
Where \(t^*\) follows a t-distribution with \(n_1 + n_2 -2\) degrees of
|
||||
freedom under \(H_0\). Thus, the p-value is
|
||||
\(P(t_{n_1 + n_2 -2} \ge |t^*|)\) for a one sided test, and twice that
|
||||
for a two sided test.
|
||||
|
||||
\hypertarget{assumptions}{%
|
||||
\subparagraph{Assumptions:}\label{assumptions}}
|
||||
|
||||
The two populations are independently normally distributed with the same
|
||||
variance.
|
||||
|
||||
\hypertarget{example-5}{%
|
||||
\subsubsection{Example}\label{example-5}}
|
||||
|
||||
\(H_0\): \(\mu_c = \mu_d\)
|
||||
|
||||
\(H_a\): \(\mu_c = \mu_d\)
|
||||
|
||||
\[s_p^2 = {(n_1 -1)s_1^2 + (n_2 - 1)s_2^2 \over n_1 + n_2 -2}\]
|
||||
\[s_p^2 = {(10 -1)(5.73) + (10 - 1)(4.9) \over 18} = 5.315\]
|
||||
\[s_p = \sqrt{5.315}\]
|
||||
|
||||
Find the p-value: \[2P(t_{n_1 + n_2 - 2} \ge |3.394|) = 0.00326\] Since
|
||||
the p-value \(< \alpha\), we reject \(H_0\).
|
||||
|
||||
Sample evidence suggests that the mean tap rate for the caffeinated
|
||||
group is different than that for the con-caffeinated group.
|
||||
|
||||
\hypertarget{example-6}{%
|
||||
\subsubsection{Example}\label{example-6}}
|
||||
|
||||
The thickness of a plastic film in mils on a substrate material is
|
||||
thought to be influenced by the temperature at which the coating is
|
||||
applied. A completely randomized experiment is carried out. 11
|
||||
substrates are coated at 125\(^\circ\)F, resulting in sample mean
|
||||
coating thickness of \(\bar{x}_1 = 103.5\), and sample standard
|
||||
deviation of \(s_1 = 10.2\). Another 13 substrates are coated at
|
||||
150\(^\circ\)F, where \(\bar{x}_2 = 99.7\) and \(s_2 = 15.1\). It is
|
||||
suspected that raising the process temperature would reduce the mean
|
||||
coating thickness. Does the data support this claim? Use
|
||||
\(\alpha = 0.01\).
|
||||
|
||||
\begin{longtable}[]{@{}lll@{}}
|
||||
\toprule()
|
||||
& 125\(^\circ\)F & 150\(^\circ\)F \\
|
||||
\midrule()
|
||||
\endhead
|
||||
\(\bar{x}\) & 103.5 & 99.7 \\
|
||||
\(s\) & 10.2 & 15.1 \\
|
||||
\(n\) & 11 & 13 \\
|
||||
\bottomrule()
|
||||
\end{longtable}
|
||||
|
||||
\(H_0\): \(\mu_1 = \mu_2\)
|
||||
|
||||
\(H_a\): \(\mu_1 < \mu_2\)
|
||||
|
||||
\[t^* = {(\bar{x}_1 - \bar{x}_2) \over s_p \sqrt{{1\over n_1} + {1\over n_2}}}\]
|
||||
\[s_p^2 = {(11 - 1)(10.2)^2 + (13-1)(15.1)^2 \over 11 + 13 - 2} = 171.66\]
|
||||
\[s_p = 13.1\]
|
||||
\[t^* = {(99.7 - 103.5) \over 13.1 \sqrt{{1\over11} + {1\over13}}} = -0.71\]
|
||||
|
||||
Find the p-value: \[P(t_{n_1 + n_2 - 2} > |-0.71|) = 0.243\] Since the
|
||||
p-value is greater than \(\alpha\), we fail to reject \(H_0\). That is
|
||||
to say sample evidence does not suggest that raising the process
|
||||
temperature would reduce the mean coating thickness.
|
||||
|
||||
\hypertarget{practical-vs.-statistical-significance}{%
|
||||
\subsection{Practical vs.~Statistical
|
||||
Significance}\label{practical-vs.-statistical-significance}}
|
||||
|
||||
More samples is not always better. * Waste of resources * Statistical
|
||||
significance \(\ne\) practical significance
|
||||
|
||||
\hypertarget{example-7}{%
|
||||
\subsubsection{Example}\label{example-7}}
|
||||
|
||||
Consider an SAT score improvement study.
|
||||
|
||||
\$600 study plan: \(x_{11}, x_{12}, \cdots, x_{1n}\)
|
||||
|
||||
Traditional study plan: \(x_{21}, x_{22}, \cdots, x_{2n}\)
|
||||
|
||||
Test for \(H_0\): \(\mu_1 = \mu_2\)
|
||||
|
||||
\(H_a\): \(\mu_1 \ne \mu_2\)
|
||||
|
||||
Test statistic:
|
||||
\[t^* = {\bar{x}_1 - \bar{x}_2 \over s_p \sqrt{{1\over n_1} + {1\over n_2}}}\]
|
||||
Suppose that \(\mu_1 - \mu_2 = 1\) point. When \(n \to \infty\),
|
||||
\(\bar{x}_1 - \bar{x}_2 \xrightarrow{p} \mu_1 - \mu_2\),
|
||||
\(s_p^2 \to \sigma^2\) as \(n\to \infty\).
|
Binary file not shown.
After Width: | Height: | Size: 24 KiB |
Binary file not shown.
After Width: | Height: | Size: 16 KiB |
@ -0,0 +1,96 @@
|
||||
\relax
|
||||
\providecommand{\transparent@use}[1]{}
|
||||
\providecommand\hyper@newdestlabel[2]{}
|
||||
\providecommand\HyperFirstAtBeginDocument{\AtBeginDocument}
|
||||
\HyperFirstAtBeginDocument{\ifx\hyper@anchor\@undefined
|
||||
\global\let\oldnewlabel\newlabel
|
||||
\gdef\newlabel#1#2{\newlabelxx{#1}#2}
|
||||
\gdef\newlabelxx#1#2#3#4#5#6{\oldnewlabel{#1}{{#2}{#3}}}
|
||||
\AtEndDocument{\ifx\hyper@anchor\@undefined
|
||||
\let\newlabel\oldnewlabel
|
||||
\fi}
|
||||
\fi}
|
||||
\global\let\hyper@last\relax
|
||||
\gdef\HyperFirstAtBeginDocument#1{#1}
|
||||
\providecommand\HyField@AuxAddToFields[1]{}
|
||||
\providecommand\HyField@AuxAddToCoFields[2]{}
|
||||
\providecommand\BKM@entry[2]{}
|
||||
\providecommand \oddpage@label [2]{}
|
||||
\BKM@entry{id=1,open,dest={746F632E73656374696F6E},srcline={16}}{5C3337365C3337375C303030435C3030306F5C3030306E5C303030745C303030655C3030306E5C303030745C30303073}
|
||||
\pgfsyspdfmark {pgfid1}{4025872}{43485761}
|
||||
\pgfsyspdfmark {pgfid2}{6935668}{37980737}
|
||||
\pgfsyspdfmark {pgfid3}{36232565}{37980737}
|
||||
\pgfsyspdfmark {pgfid4}{6935668}{34074791}
|
||||
\pgfsyspdfmark {pgfid5}{36232565}{34074791}
|
||||
\pgfsyspdfmark {pgfid6}{6935668}{30411328}
|
||||
\pgfsyspdfmark {pgfid7}{36232565}{30411328}
|
||||
\BKM@entry{id=2,open,dest={636861707465722E31},srcline={20}}{5C3337365C3337375C303030315C3030305C3034305C303030505C303030725C3030306F5C303030625C303030615C303030625C303030695C3030306C5C303030695C303030745C303030795C3030305C3034305C303030445C303030655C3030306E5C303030735C303030695C303030745C303030795C3030305C3034305C303030615C3030306E5C303030645C3030305C3034305C303030435C303030755C3030306D5C303030755C3030306C5C303030615C303030745C303030695C303030765C303030655C3030305C3034305C303030445C303030695C303030735C303030745C303030725C303030695C303030625C303030755C303030745C303030695C3030306F5C3030306E5C3030305C3034305C303030465C303030755C3030306E5C303030635C303030745C303030695C3030306F5C3030306E5C30303073}
|
||||
\@writefile{toc}{\contentsline {chapter}{\numberline {1}Probability Density and Cumulative Distribution Functions}{2}{chapter.1}\protected@file@percent }
|
||||
\@writefile{lof}{\addvspace {10\p@ }}
|
||||
\@writefile{lot}{\addvspace {10\p@ }}
|
||||
\@writefile{loa}{\addvspace {10\p@ }}
|
||||
\BKM@entry{id=3,open,dest={73656374696F6E2E312E31},srcline={102}}{5C3337365C3337375C303030315C3030302E5C303030315C3030305C3034305C303030435C3030306F5C3030306E5C303030745C303030695C3030306E5C303030755C3030306F5C303030755C303030735C3030305C3034305C303030505C303030725C3030306F5C303030625C303030615C303030625C303030695C3030306C5C303030695C303030745C303030795C3030305C3034305C303030445C303030695C303030735C303030745C303030725C303030695C303030625C303030755C303030745C303030695C3030306F5C3030306E5C30303073}
|
||||
\@writefile{toc}{\contentsline {paragraph}{a)}{3}{section*.2}\protected@file@percent }
|
||||
\@writefile{toc}{\contentsline {paragraph}{b)}{3}{section*.3}\protected@file@percent }
|
||||
\@writefile{toc}{\contentsline {paragraph}{c)}{3}{section*.4}\protected@file@percent }
|
||||
\@writefile{toc}{\contentsline {section}{\numberline {1.1}Continuous Probability Distributions}{3}{section.1.1}\protected@file@percent }
|
||||
\@writefile{toc}{\contentsline {paragraph}{a)}{4}{section*.5}\protected@file@percent }
|
||||
\@writefile{toc}{\contentsline {paragraph}{b)}{5}{section*.6}\protected@file@percent }
|
||||
\BKM@entry{id=4,open,dest={636861707465722E32},srcline={190}}{5C3337365C3337375C303030325C3030305C3034305C303030455C303030785C303030705C303030655C303030635C303030745C303030655C303030645C3030305C3034305C303030565C303030615C3030306C5C303030755C30303065}
|
||||
\@writefile{toc}{\contentsline {chapter}{\numberline {2}Expected Value}{7}{chapter.2}\protected@file@percent }
|
||||
\@writefile{lof}{\addvspace {10\p@ }}
|
||||
\@writefile{lot}{\addvspace {10\p@ }}
|
||||
\@writefile{loa}{\addvspace {10\p@ }}
|
||||
\@writefile{toc}{\contentsline {subsubsection}{Example}{8}{section*.7}\protected@file@percent }
|
||||
\newlabel{example-1}{{2}{8}{Example}{section*.7}{}}
|
||||
\@writefile{toc}{\contentsline {subsubsection}{Properties of Expectations}{8}{section*.8}\protected@file@percent }
|
||||
\newlabel{properties-of-expectations}{{2}{8}{Properties of Expectations}{section*.8}{}}
|
||||
\@writefile{toc}{\contentsline {subsubsection}{Example}{8}{section*.9}\protected@file@percent }
|
||||
\newlabel{example-2}{{2}{8}{Example}{section*.9}{}}
|
||||
\@writefile{toc}{\contentsline {subsubsection}{Variance of a Random Variable}{8}{section*.10}\protected@file@percent }
|
||||
\newlabel{variance-of-a-random-variable}{{2}{8}{Variance of a Random Variable}{section*.10}{}}
|
||||
\@writefile{toc}{\contentsline {subsubsection}{Definition}{8}{section*.11}\protected@file@percent }
|
||||
\newlabel{definition-1}{{2}{8}{Definition}{section*.11}{}}
|
||||
\@writefile{toc}{\contentsline {subsubsection}{Example}{9}{section*.12}\protected@file@percent }
|
||||
\newlabel{example-3}{{2}{9}{Example}{section*.12}{}}
|
||||
\@writefile{toc}{\contentsline {subsubsection}{Example}{9}{section*.13}\protected@file@percent }
|
||||
\newlabel{example-4}{{2}{9}{Example}{section*.13}{}}
|
||||
\@writefile{toc}{\contentsline {subsubsection}{Theorem}{9}{section*.14}\protected@file@percent }
|
||||
\newlabel{theorem}{{2}{9}{Theorem}{section*.14}{}}
|
||||
\@writefile{toc}{\contentsline {subsubsection}{Example}{9}{section*.15}\protected@file@percent }
|
||||
\newlabel{example-5}{{2}{9}{Example}{section*.15}{}}
|
||||
\BKM@entry{id=5,open,dest={73756273656374696F6E2E322E302E31},srcline={349}}{5C3337365C3337375C303030325C3030302E5C303030305C3030302E5C303030315C3030305C3034305C303030545C303030685C303030655C3030305C3034305C303030455C303030785C303030705C3030306F5C3030306E5C303030655C3030306E5C303030745C303030695C303030615C3030306C5C3030305C3034305C303030445C303030695C303030735C303030745C303030725C303030695C303030625C303030755C303030745C303030695C3030306F5C3030306E}
|
||||
\@writefile{toc}{\contentsline {subsection}{\numberline {2.0.1}The Exponential Distribution}{10}{subsection.2.0.1}\protected@file@percent }
|
||||
\newlabel{the-exponential-distribution}{{2.0.1}{10}{The Exponential Distribution}{subsection.2.0.1}{}}
|
||||
\newlabel{application}{{2.0.1}{10}{Application}{section*.16}{}}
|
||||
\@writefile{toc}{\contentsline {paragraph}{Application}{10}{section*.16}\protected@file@percent }
|
||||
\@writefile{toc}{\contentsline {subsubsection}{Example}{10}{section*.17}\protected@file@percent }
|
||||
\newlabel{example-6}{{2.0.1}{10}{Example}{section*.17}{}}
|
||||
\BKM@entry{id=6,open,dest={73756273656374696F6E2E322E302E32},srcline={411}}{5C3337365C3337375C303030325C3030302E5C303030305C3030302E5C303030325C3030305C3034305C303030545C303030685C303030655C3030305C3034305C3030304E5C3030306F5C303030725C3030306D5C303030615C3030306C5C3030305C3034305C303030445C303030695C303030735C303030745C303030725C303030695C303030625C303030755C303030745C303030695C3030306F5C3030306E}
|
||||
\@writefile{toc}{\contentsline {subsection}{\numberline {2.0.2}The Normal Distribution}{11}{subsection.2.0.2}\protected@file@percent }
|
||||
\newlabel{the-normal-distribution}{{2.0.2}{11}{The Normal Distribution}{subsection.2.0.2}{}}
|
||||
\@writefile{toc}{\contentsline {subsubsection}{Definition}{11}{section*.18}\protected@file@percent }
|
||||
\newlabel{definition-2}{{2.0.2}{11}{Definition}{section*.18}{}}
|
||||
\@writefile{toc}{\contentsline {subsubsection}{Example}{11}{section*.19}\protected@file@percent }
|
||||
\newlabel{example-7}{{2.0.2}{11}{Example}{section*.19}{}}
|
||||
\@writefile{toc}{\contentsline {subsubsection}{Example}{12}{section*.20}\protected@file@percent }
|
||||
\newlabel{example-8}{{2.0.2}{12}{Example}{section*.20}{}}
|
||||
\BKM@entry{id=7,open,dest={636861707465722E33},srcline={479}}{5C3337365C3337375C303030335C3030305C3034305C303030485C303030795C303030705C3030306F5C303030745C303030685C303030655C303030735C303030695C303030735C3030305C3034305C303030545C303030655C303030735C303030745C303030695C3030306E5C30303067}
|
||||
\BKM@entry{id=8,open,dest={73756273656374696F6E2E332E302E31},srcline={512}}{5C3337365C3337375C303030335C3030302E5C303030305C3030302E5C303030315C3030305C3034305C303030435C3030306F5C3030306E5C303030665C303030695C303030645C303030655C3030306E5C303030635C303030655C3030305C3034305C303030495C3030306E5C303030745C303030655C303030725C303030765C303030615C3030306C5C3030305C3034305C303030665C3030306F5C303030725C3030305C3034305C303030745C303030685C303030655C3030305C3034305C303030445C303030695C303030665C303030665C303030655C303030725C303030655C3030306E5C303030635C303030655C3030305C3034305C3030306F5C303030665C3030305C3034305C303030545C303030775C3030306F5C3030305C3034305C3030304D5C303030655C303030615C3030306E5C30303073}
|
||||
\@writefile{toc}{\contentsline {chapter}{\numberline {3}Hypothesis Testing}{13}{chapter.3}\protected@file@percent }
|
||||
\@writefile{lof}{\addvspace {10\p@ }}
|
||||
\@writefile{lot}{\addvspace {10\p@ }}
|
||||
\@writefile{loa}{\addvspace {10\p@ }}
|
||||
\@writefile{toc}{\contentsline {subsection}{\numberline {3.0.1}Confidence Interval for the Difference of Two Means}{13}{subsection.3.0.1}\protected@file@percent }
|
||||
\BKM@entry{id=9,open,dest={73756273656374696F6E2E332E302E32},srcline={569}}{5C3337365C3337375C303030335C3030302E5C303030305C3030302E5C303030325C3030305C3034305C303030505C303030615C303030695C303030725C303030655C303030645C3030305C3034305C303030745C3030302D5C303030745C303030655C303030735C30303074}
|
||||
\@writefile{toc}{\contentsline {subsection}{\numberline {3.0.2}Paired t-test}{14}{subsection.3.0.2}\protected@file@percent }
|
||||
\BKM@entry{id=10,open,dest={73656374696F6E2E332E31},srcline={645}}{5C3337365C3337375C303030335C3030302E5C303030315C3030305C3034305C303030415C3030306E5C303030615C3030306C5C303030795C303030735C303030695C303030735C3030305C3034305C3030306F5C303030665C3030305C3034305C303030565C303030615C303030725C303030695C303030615C3030306E5C303030635C30303065}
|
||||
\@writefile{toc}{\contentsline {section}{\numberline {3.1}Analysis of Variance}{16}{section.3.1}\protected@file@percent }
|
||||
\BKM@entry{id=11,open,dest={73756273656374696F6E2E332E312E31},srcline={724}}{5C3337365C3337375C303030335C3030302E5C303030315C3030302E5C303030315C3030305C3034305C303030545C303030655C303030735C303030745C303030735C3030305C3034305C3030306F5C303030665C3030305C3034305C303030485C303030795C303030705C3030306F5C303030745C303030685C303030655C303030735C303030655C30303073}
|
||||
\@writefile{toc}{\contentsline {subsection}{\numberline {3.1.1}Tests of Hypotheses}{17}{subsection.3.1.1}\protected@file@percent }
|
||||
\BKM@entry{id=12,open,dest={73656374696F6E2E332E32},srcline={792}}{5C3337365C3337375C303030335C3030302E5C303030325C3030305C3034305C3030304E5C3030306F5C3030306E5C3030302D5C303030505C303030615C303030725C303030615C3030306D5C303030655C303030745C303030725C303030695C303030635C3030305C3034305C303030545C303030655C303030735C303030745C303030695C3030306E5C30303067}
|
||||
\BKM@entry{id=13,open,dest={73756273656374696F6E2E332E322E31},srcline={795}}{5C3337365C3337375C303030335C3030302E5C303030325C3030302E5C303030315C3030305C3034305C303030545C303030685C303030655C3030305C3034305C303030535C303030695C303030675C3030306E5C303030655C303030645C3030305C3034305C303030525C303030615C3030306E5C3030306B5C3030305C3034305C303030545C303030655C303030735C30303074}
|
||||
\@writefile{toc}{\contentsline {section}{\numberline {3.2}Non-Parametric Testing}{18}{section.3.2}\protected@file@percent }
|
||||
\@writefile{toc}{\contentsline {subsection}{\numberline {3.2.1}The Signed Rank Test}{18}{subsection.3.2.1}\protected@file@percent }
|
||||
\ttl@finishall
|
||||
\gdef \@abspage@last{20}
|
File diff suppressed because it is too large
Load Diff
Binary file not shown.
@ -0,0 +1,851 @@
|
||||
\documentclass{report}
|
||||
|
||||
\input{preamble}
|
||||
\input{macros}
|
||||
\input{letterfonts}
|
||||
|
||||
\title{\Huge{Prob and Stat for ECEs}}
|
||||
\author{\huge{Aidan Sharpe}}
|
||||
\date{}
|
||||
|
||||
\begin{document}
|
||||
|
||||
\maketitle
|
||||
\newpage% or \cleardoublepage
|
||||
% \pdfbookmark[<level>]{<title>}{<dest>}
|
||||
\pdfbookmark[section]{\contentsname}{toc}
|
||||
\tableofcontents
|
||||
\pagebreak
|
||||
|
||||
\chapter{Probability Density and Cumulative Distribution Functions}
|
||||
\ex{}{
|
||||
Suppose there are 30 resistors, 7 of them do not work. You randomly
|
||||
choose 3 of them. Let $X$ be the number of defective resistors. Find
|
||||
the probability distribution of $X$.
|
||||
|
||||
$$ X = [0,3]$$
|
||||
$$P(X=0) = { {7 \choose 0} {23 \choose 3} \over {30 \choose 3} } = 0.436$$
|
||||
$$P(X=1) = { {7 \choose 1} {23 \choose 2} \over {30 \choose 3} } = 0.436$$
|
||||
$$P(X=2) = { {7 \choose 2} {23 \choose 1} \over {30 \choose 3} } = 0.119$$
|
||||
$$P(X=3) = { {7 \choose 3} {23 \choose 0} \over {30 \choose 3} } = 0.009$$
|
||||
|
||||
Probability distribution:
|
||||
$$P(X = x) =
|
||||
\begin{cases}
|
||||
0.436 & x=0 \\
|
||||
0.436 & x=1 \\
|
||||
0.119 & x=2 \\
|
||||
0.009 & x=3
|
||||
\end{cases}$$
|
||||
}
|
||||
|
||||
\dfn{The Cumulative Distribution Function}
|
||||
{
|
||||
The cumulative distribution function (CDF), $F(x)$, of a discrete random variable, $x$, with probability distribution, $f(x)$, is:
|
||||
$$F(x) = P(X \le x)$$
|
||||
}
|
||||
\noindent
|
||||
Find CDF for the example above:
|
||||
$$F(0) = P(X \le 0) = P(X = 0) = 0.436$$
|
||||
$$F(1) = P(X \le 1) = P((X = 0) \cup (X=1)) = 0.872$$
|
||||
$$F(2) = P(X \le 2) = P((X=0) \cup (X=1) \cup (X=2)) = 0.991$$
|
||||
Since 3 is the largest possible value for $x$:
|
||||
$$F(3) = P(X \le 3) = 1$$
|
||||
\noindent
|
||||
As a piecewise function:
|
||||
$$F(x) =
|
||||
\begin{cases}
|
||||
0 & x < 0 \\
|
||||
0.436 & 0 \le x < 1 \\
|
||||
0.872 & 1 \le x < 2 \\
|
||||
0.991 & 2 \le x < 3 \\
|
||||
1 & x \ge 3
|
||||
\end{cases}$$
|
||||
|
||||
\ex{}{
|
||||
Suppose that a days production of 850 manufactured parts contains 50
|
||||
parts that to not conform to customer requirements. 2 parts are selected
|
||||
at random from the batch. Let $X$ be the number of non-conforming
|
||||
parts.
|
||||
|
||||
\paragraph{a)}
|
||||
|
||||
Find the probability distribution for $X$:
|
||||
$$P(X = 0) = { {50 \choose 0} {800 \choose 2} \over {850 \choose 2 }} = 0.8857$$
|
||||
$$P(X = 1) = { {50 \choose 1} {800 \choose 1} \over {850 \choose 2 }} = 0.1109$$
|
||||
$$P(X = 2) = { {50 \choose 2} {800 \choose 0} \over {850 \choose 2 }} = 0.0034$$
|
||||
|
||||
$$P(X = x) =
|
||||
\begin{cases}
|
||||
0.8857 & x=0 \\
|
||||
0.1109 & x=1 \\
|
||||
0.0034 & x=2
|
||||
\end{cases}$$
|
||||
|
||||
\paragraph{b)}
|
||||
|
||||
Find the CDF $F(x)$:
|
||||
$$F(x) =
|
||||
\begin{cases}
|
||||
0 & x < 0 \\
|
||||
0.8857 & 0 \le x < 1 \\
|
||||
0.9966 & 1 \le x < 2 \\
|
||||
1 & x \ge 2
|
||||
\end{cases}$$
|
||||
|
||||
\paragraph{c)}
|
||||
|
||||
Plot $F(x)$:
|
||||
|
||||
}
|
||||
|
||||
\section{Continuous Probability Distributions}
|
||||
A continuous random variable is a variable that can take on any value within a range. It takes on infinitely many possible value within the range.
|
||||
|
||||
\includegraphics{NormalDistribution.png}
|
||||
|
||||
\noindent
|
||||
For a continuous distribution, $f(x)$:
|
||||
$$P(X = x) = 0$$
|
||||
$$P(x_0 \le X \le x_1) = \int\limits_{x_0}^{x_1} f(x) dx$$
|
||||
$$P(X \ge x_0) = \int\limits_{x_0}^{\infty} f(x) dx$$
|
||||
|
||||
\dfn{}{
|
||||
The function, $f(x)$, is a probability density function fo the
|
||||
continuous random variable, $X$, defined over $\Reals$ if:
|
||||
|
||||
\begin{enumerate}
|
||||
\item
|
||||
$$f(x) \ge 0, \forall x \in \Reals$$
|
||||
\item
|
||||
$$\int\limits_{-\infty}^{\infty} f(x) dx = 1$$
|
||||
\item
|
||||
$$P(x_0 \le X \le x_1) = P(x_0 < X < x_1)$$ $$= P(x_0 \le X < x_1)$$
|
||||
$$= P(x_0 < X \le x_1)$$
|
||||
\end{enumerate}
|
||||
|
||||
}
|
||||
|
||||
\ex{}{
|
||||
Suppose that the error in the reaction temperature in $^\circ \text{C}$ for a controlled lab experiment is a continuous random variable, $X$, having PDF:
|
||||
$$f(x) =
|
||||
\begin{cases}
|
||||
{x^2 \over 3} & -1 < x < 2 \\
|
||||
0 & \text{elsewhere}
|
||||
\end{cases}$$
|
||||
|
||||
\paragraph{a)} Verify that $f(x)$ is a PDF.
|
||||
$$\int\limits_{-1}^{2} {x^2 \over 3} dx \stackrel{?}{=} 1$$
|
||||
$${1 \over 3} \left[{1 \over 3} x^3 \Big\vert_{-1}^{2}\right] = {1\over9}[8- (-1)] = 1$$
|
||||
|
||||
\paragraph{b)} Find $P(0 < X < 0.5)$:
|
||||
$$P(0 < X < 0.5) = \int\limits_0^{0.5} {x^2 \over 3}dx$$
|
||||
$${1\over9}\left[x^3 \Big|_0^{0.5}\right] = {1\over9}[0.125] = 0.01389$$
|
||||
}
|
||||
|
||||
\dfn{}
|
||||
{
|
||||
The CDF, $F(x)$ of a continuous random variable, $X$, with probability density function $f(x)$ is:
|
||||
$$F(x) = P(X \le x) = \int\limits_{-\infty}^x f(t) dt$$
|
||||
}
|
||||
|
||||
\nt{
|
||||
\begin{enumerate}
|
||||
\def\labelenumi{\arabic{enumi}.}
|
||||
\tightlist
|
||||
\item
|
||||
$$P(a < X < b) = F(b) - F(a)$$
|
||||
\item
|
||||
$$f(x) = {d\over dx}F(x)$$
|
||||
\end{enumerate}
|
||||
}
|
||||
|
||||
\ex{}{
|
||||
Find the CDF of the previous example $$f(x) =
|
||||
\begin{cases}
|
||||
{x^2 \over 3} & -1 < x < 2 \\
|
||||
0 & \text{elsewhere}
|
||||
\end{cases}$$
|
||||
|
||||
$$F(x) = \int\limits_{-1}^x {t^2 \over 3} dt$$
|
||||
$${1/over 9}\left[t^3\Big|_{-1}^x\right] = {1\over 9}\left[x^3 + 1\right]$$
|
||||
$$F(x) = \begin{cases}
|
||||
0 & t < -1 \\
|
||||
{1\over 9} \left[x^3 + 1\right] & -1 \le x \le 2 \\
|
||||
1 & \text{\text{elsewhere}}
|
||||
\end{cases}$$
|
||||
}
|
||||
|
||||
\ex{}{
|
||||
The proportion of the budget for a certain type of industrial company that is allotted to environmental and pollution control is coming under scrutiny. A data collection project determines that the distribution of these proportions is given by: $$f(y) = \begin{cases}
|
||||
k(1-y)^4 & 0 \le y \le 1 \\
|
||||
0 & \text{elsewhere}
|
||||
\end{cases}$$
|
||||
|
||||
Find $k$ that renders \$f(y) a valid density function:
|
||||
$$\int\limits_0^1 k(1-y)^4dy = 1$$ $${k\over5} = 1$$
|
||||
$$\therefore k = 5$$
|
||||
}
|
||||
|
||||
\chapter{Expected Value}
|
||||
|
||||
\dfn{Expected Value}
|
||||
{
|
||||
Let $X$ be a random variable with probability distribution $f(x)$. The mean, or expected value, of $X$ is:
|
||||
|
||||
For a discrete distribution $$E[X] = \sum\limits_x xf(x)$$
|
||||
|
||||
For a continuous distribution:
|
||||
$$E[X] = \int\limits_{-\infty}^{\infty} xf(x)dx$$
|
||||
}
|
||||
|
||||
\noindent
|
||||
Given $\{1, 2, 3, 3, 5\}$, the mean is: $${1+2+3+3+5 \over 5} = 2.8$$
|
||||
$$f(x) = \begin{cases}
|
||||
{1\over5} & x=1 \\
|
||||
{1\over5} & x=2 \\
|
||||
{2\over5} & x=3 \\
|
||||
{1\over5} & x=5 \\
|
||||
\end{cases}$$
|
||||
|
||||
$$\sum\limits_x xf(x) = {1\over5}(1) + {1\over5}(2) + {1\over5}(3) + {1\over5}(5) = 2.8$$
|
||||
|
||||
\ex{}
|
||||
{
|
||||
The probability distribution of a discrete random variable $X$ is:
|
||||
$$f(x) = {3 \choose x}\left({1 \over 4}\right)^x\left({3\over4}\right)^{3-x}, x \in \{0, 1, 2, 3\}$$
|
||||
Find $E[X]$: $$f(x) =
|
||||
\begin{cases}
|
||||
0 & x=0 \\
|
||||
0.422 & x=1 \\
|
||||
0.14 & x=2 \\
|
||||
{1\over64} & x=3
|
||||
\end{cases}$$
|
||||
|
||||
$$E[X] = \sum\limits_x x {3 \choose x}\left({1\over4}\right)^x \left({3\over4}\right)^{3-x}$$
|
||||
$$E[X] = 0(0)+ 0.422(1) + 0.14(2) + {1\over64}(3) = 0.75$$
|
||||
}
|
||||
|
||||
\hypertarget{example-1}{%
|
||||
\subsubsection{Example}\label{example-1}}
|
||||
|
||||
Let $X$ be the random variable that denotes the life in hours of a
|
||||
certain electronic device. The PDF is: $$f(x) =
|
||||
\begin{cases}
|
||||
{20000\over x^3} & x > 100 \\
|
||||
0 & elsewhere
|
||||
\end{cases}$$
|
||||
|
||||
Find the expected life of this type of device:
|
||||
$$E[X] = \int\limits_{-\infty}^{\infty} xf(x)dx = \int\limits_{100}^{\infty}x{20000 \over x^3}dx = 200 \text{[hrs]}$$
|
||||
|
||||
\textbf{Note:} $$E[x^2] = \int\limits_{\infty}^{\infty}x^2f(x)dx$$
|
||||
|
||||
\hypertarget{properties-of-expectations}{%
|
||||
\subsubsection{Properties of
|
||||
Expectations}\label{properties-of-expectations}}
|
||||
|
||||
$$E(b) = b$$ Where $b$ is a constant $$E(aX) = aE[X]$$ Where $a$ is
|
||||
a constant $$E(aX + b) aE[X] + b$$ $$E[X + Y] = E[X] + E[Y]$$ Where
|
||||
$X$ and $Y$ are random variables
|
||||
|
||||
\hypertarget{example-2}{%
|
||||
\subsubsection{Example}\label{example-2}}
|
||||
|
||||
Given: $$f(x) = \begin{cases}
|
||||
{x^2\over3} & -1 < x < 2 \\
|
||||
0 & \text{elsewhere}
|
||||
\end{cases}$$ Find the expected value of $Y = 4X + 3$:
|
||||
|
||||
$$E[Y] = E[4X + 3] = 4E[X] + 3$$
|
||||
$$E[X] = \int\limits_{-1}^{3} {X^3 \over 3}dx = {1\over12}X^4 \Big|_{-1}^{3}={5\over4}$$
|
||||
|
||||
\hypertarget{variance-of-a-random-variable}{%
|
||||
\subsubsection{Variance of a Random
|
||||
Variable}\label{variance-of-a-random-variable}}
|
||||
|
||||
The expected value/mean is of special importance because it describes
|
||||
where the probability distribution is centered. However, we also need to
|
||||
characterize the variance of the distribution.
|
||||
|
||||
\hypertarget{definition-1}{%
|
||||
\subsubsection{Definition}\label{definition-1}}
|
||||
|
||||
Let $X$ be a random variable with probability distribution, $f(x)$,
|
||||
and mean, $\mu$. The variance of $X$ is given by:
|
||||
$$\text{Var}[X] = E[(X-\mu)^2]$$ Which is the average squared distance
|
||||
away from the mean. This simplifies to:
|
||||
$$\text{Var}[X] = E[X^2] - E[X]^2$$ \textbf{Note:} Generally,
|
||||
$$E[X^2] \ne E[X]^2$$
|
||||
|
||||
The standard deviation, $\sigma$, is given by:
|
||||
$$\sigma = \sqrt{\text{Var}[X]}$$
|
||||
|
||||
\textbf{Note}: The variance is a measure of uncertainty (spread) in the
|
||||
data.
|
||||
|
||||
\hypertarget{example-3}{%
|
||||
\subsubsection{Example}\label{example-3}}
|
||||
|
||||
The weekly demand for a drinking water product in thousands of liters
|
||||
from a local chain of efficiency stores is a continuous random variable,
|
||||
$X$, having the probability density: $$F(x) = \begin{cases}
|
||||
2(x-1) & 1 < x < 2 \\
|
||||
0 & \text{elsewhere}
|
||||
\end{cases}$$
|
||||
|
||||
Find the expected value:
|
||||
$$E[X] = \int\limits_1^2 x (2(x-1)) dx = 2\int\limits_1^2 (x^2 - x)dx$$
|
||||
$$E[X] = 2\left[{1\over3}x^3 - {1\over2}x^2 \Big|_1^2 \right] = {5\over3}$$
|
||||
|
||||
Find the variance: $$\text{Var}[X] = E[X^2] - E[X]^2$$
|
||||
$$E[X^2] = \int\limits_1^2 2x^2(x-1)dx = 2\int\limits_1^2 (x^3 - x^2)dx$$
|
||||
$$E[X^2] = {17\over6}$$
|
||||
$$\text{Var}[X] = {17\over6} - \left({5\over3}\right)^2 = {1\over18}$$
|
||||
|
||||
Find the standard deviation:
|
||||
$$\sigma = \sqrt{\text{Var}[X]} = {1\over3\sqrt{2}} = {\sqrt{2}\over6}$$
|
||||
|
||||
\hypertarget{example-4}{%
|
||||
\subsubsection{Example}\label{example-4}}
|
||||
|
||||
The mean and variance are useful when comparing two or more
|
||||
distributions.
|
||||
|
||||
\begin{longtable}[]{@{}lll@{}}
|
||||
\toprule()
|
||||
& Plan 1 & Plan 2 \\
|
||||
\midrule()
|
||||
\endhead
|
||||
Avg Score Improvement & $+17$ & $+15$ \\
|
||||
Standard deviation & $\pm8$ & $\pm2$ \\
|
||||
\bottomrule()
|
||||
\end{longtable}
|
||||
|
||||
\hypertarget{theorem}{%
|
||||
\subsubsection{Theorem}\label{theorem}}
|
||||
|
||||
If $X$ has variance, $\text{Var}[X]$, then
|
||||
$\text{Var}[aX + b] = a^2\text{Var}[X]$.
|
||||
|
||||
\hypertarget{example-5}{%
|
||||
\subsubsection{Example}\label{example-5}}
|
||||
|
||||
The length of time, in minutes, for an airplane to obtain clearance at a
|
||||
certain airport is a random variable, $Y = 3X - 2$, where $X$ has
|
||||
the density: $$F(x) = \begin{cases}
|
||||
{1\over4} e^{x/4} & x > 0 \\
|
||||
0 & \text{elsewhere}
|
||||
\end{cases}$$
|
||||
|
||||
$$E[X] = 4$$ $$\text{Var}[X] = 16$$
|
||||
|
||||
Find $E[Y]$: $$E[Y] = E[3X-2] = 3E[X] - 2 = 10$$
|
||||
$$\text{Var}[Y] = 3^2\text{Var}[X] = 144$$
|
||||
$$\sigma = \sqrt{\text{Var}[Y]} = 12$$
|
||||
|
||||
\hypertarget{the-exponential-distribution}{%
|
||||
\subsection{The Exponential
|
||||
Distribution}\label{the-exponential-distribution}}
|
||||
|
||||
The continuous random variable, $X$, has an exponential distribution
|
||||
with parameter $\beta$ if its density function is given by:
|
||||
$$F(x) = \begin{cases}
|
||||
{1\over\beta}e^{-x/\beta} & x > 0 \\
|
||||
0 & \text{elsewhere}
|
||||
\end{cases}$$
|
||||
|
||||
Where $\beta > 0$.
|
||||
|
||||
$$E[X] = \beta$$
|
||||
$$E[X] = \int\limits_0^{\infty} x{1\over\beta}e^{-x/\beta} dx$$
|
||||
|
||||
Aside: $$\Gamma(Z) = \int\limits_0^\infty x^{Z - 1}e^{-x}dx$$ Where
|
||||
$\Gamma(Z) = (Z - 1)!$
|
||||
|
||||
$$E[X] = \beta \int\limits_0^\infty \left({x\over\beta}\right)^{(2-1)} e^{-x/\beta} \left({dx\over\beta}\right) = \beta\Gamma(2)$$
|
||||
$$E[X] = \beta(2-1)! = \beta$$
|
||||
|
||||
$$\text{Var}[X] = E[X^2] - E[X]^2$$
|
||||
$$E[X^2] = \int\limits_0^\infty x^2{1\over\beta}e^{-x/\beta}dx = \beta^2 \int\limits_0^\infty \left({x\over\beta}\right)^{(2-1)} e^{-x/\beta} \left({dx\over\beta}\right)$$
|
||||
$$E[X^2] = \beta^2\Gamma(3) = 2\beta^2$$
|
||||
$$\text{Var}[X] = 2\beta^2 - \beta^2 = \beta^2$$
|
||||
|
||||
\hypertarget{application}{%
|
||||
\paragraph{Application}\label{application}}
|
||||
|
||||
Reliability analysis: the time to failure of a certain electronic
|
||||
component can be modeled by an exponential distribution.
|
||||
|
||||
\hypertarget{example-6}{%
|
||||
\subsubsection{Example}\label{example-6}}
|
||||
|
||||
Let $T$ be the random variable which measures the time to failure of a
|
||||
certain electronic component. Suppose $T$ has an exponential
|
||||
distribution with $\beta = 5$.
|
||||
|
||||
$$F(x) = \begin{cases}
|
||||
{1\over5}e^{-x/5} & x > 0 \\
|
||||
0 & \text{elsewhere}
|
||||
\end{cases}$$
|
||||
|
||||
If 6 of these components are in use, what is the probability that
|
||||
exactly 3 components are still functioning at the end of 8 years?
|
||||
|
||||
What is the probability that an individual component is still
|
||||
functioning after 8 years?
|
||||
|
||||
$$P(T > 8) = \int\limits_8^\infty {1\over5}e^{-x/5}dx \approx 0.2$$
|
||||
|
||||
$${6 \choose 3}(0.2)^3(0.8)^3 = 0.08192$$
|
||||
|
||||
\begin{Shaded}
|
||||
\begin{Highlighting}[]
|
||||
\OperatorTok{\textgreater{}\textgreater{}\textgreater{}} \ImportTok{from}\NormalTok{ math }\ImportTok{import}\NormalTok{ comb}
|
||||
\OperatorTok{\textgreater{}\textgreater{}\textgreater{}}\NormalTok{ comb(}\DecValTok{6}\NormalTok{,}\DecValTok{3}\NormalTok{) }\OperatorTok{*} \FloatTok{0.2}\OperatorTok{**}\DecValTok{3} \OperatorTok{*} \FloatTok{0.8}\OperatorTok{**}\DecValTok{3}
|
||||
\FloatTok{0.08192000000000003}
|
||||
\end{Highlighting}
|
||||
\end{Shaded}
|
||||
|
||||
\hypertarget{the-normal-distribution}{%
|
||||
\subsection{The Normal Distribution}\label{the-normal-distribution}}
|
||||
|
||||
The most important continuous probability distribution in the field of
|
||||
statistics is the normal distribution. It is characterized by 2
|
||||
parameters, the mean, $\mu$, and the variance, $\sigma^2$.
|
||||
$$\text{mean} = \text{median} = \text{mode}$$
|
||||
|
||||
$$F(x|\mu,\sigma^2) = {1 \over \sqrt{2\pi} \sigma^2} e^{\left({1 \over 2\sigma^2}(x-\mu)^2\right)}$$
|
||||
$$E[X] = \mu$$ $$\text{Var}[X] = \sigma^2$$
|
||||
|
||||
For a normal curve:
|
||||
$$P(x_1 < x < x_2) = \int\limits_{x_1}^{x_2} F(x)dx$$
|
||||
|
||||
\hypertarget{definition-2}{%
|
||||
\subsubsection{Definition}\label{definition-2}}
|
||||
|
||||
The distribution of a normal variable with mean 0 and variance 1 is
|
||||
called a standard normal distribution.
|
||||
|
||||
The transformation of any random variable, $X$ into a standard normal
|
||||
variable, $Z$: $$Z = {X - \mu \over \sigma}$$
|
||||
|
||||
\hypertarget{example-7}{%
|
||||
\subsubsection{Example}\label{example-7}}
|
||||
|
||||
Given a normal distribution with mean $\mu = 30$ and standard
|
||||
deviation, $\sigma = 6$, find the normal curve area to the right of
|
||||
$x = 17$.
|
||||
|
||||
Transform to standard normal. $$Z = {17 - 30 \over 6} = -2.16$$
|
||||
|
||||
That is, $x = 17$ on a normal distribution with $\mu = 30$ and
|
||||
$\sigma = 6$ is equivalent to $Z=-2.16$ on a normal distribution
|
||||
with $\mu = 0$ and $\sigma = 1$.
|
||||
|
||||
$$P(X > 17) = P(Z > -2.16)$$
|
||||
|
||||
$$P(Z > -2.16) = 1 -P(Z \le -2.16) = 0.9846$$
|
||||
|
||||
\begin{Shaded}
|
||||
\begin{Highlighting}[]
|
||||
\OperatorTok{\textgreater{}\textgreater{}\textgreater{}} \ImportTok{from}\NormalTok{ scipy.stats }\ImportTok{import}\NormalTok{ norm}
|
||||
\OperatorTok{\textgreater{}\textgreater{}\textgreater{}}\NormalTok{ norm.cdf(}\OperatorTok{{-}}\FloatTok{2.16}\NormalTok{)}
|
||||
\FloatTok{0.015386334783925445}
|
||||
\end{Highlighting}
|
||||
\end{Shaded}
|
||||
|
||||
\hypertarget{example-8}{%
|
||||
\subsubsection{Example}\label{example-8}}
|
||||
|
||||
The finished inside diameter of a piston ring is normally distributed
|
||||
with mean, $\mu = 10${[}cm{]}, and standard deviation,
|
||||
$\sigma = 0.03${[}cm{]}.
|
||||
|
||||
What is the probability that a piston ring will have inside diameter
|
||||
between 9.97{[}cm{]} and 10.03{[}cm{]}?
|
||||
|
||||
$$Z_1 = {9.97 - 10 \over 0.03} = -1$$ $$Z_2 = {10.03 - 10 \over 3} = 1$$
|
||||
$$P(9.97 < x < 10.03) = 0.68$$
|
||||
|
||||
\begin{Shaded}
|
||||
\begin{Highlighting}[]
|
||||
\OperatorTok{\textgreater{}\textgreater{}\textgreater{}} \ImportTok{from}\NormalTok{ scipy.stats }\ImportTok{import}\NormalTok{ norm}
|
||||
\OperatorTok{\textgreater{}\textgreater{}\textgreater{}}\NormalTok{ norm.cdf(}\DecValTok{1}\NormalTok{) }\OperatorTok{{-}}\NormalTok{ norm.cdf(}\OperatorTok{{-}}\DecValTok{1}\NormalTok{)}
|
||||
\FloatTok{0.6826894921370859}
|
||||
\end{Highlighting}
|
||||
\end{Shaded}
|
||||
|
||||
\chapter{Hypothesis Testing}
|
||||
There is a 1 to 1 relationship between the test of a hypothesis about any parameter, say, $\theta$, and the confidence interval for $\theta$.
|
||||
|
||||
\dfn{}
|
||||
{
|
||||
If (LB, UB) is a 100(1-$\alpha$)\% confidence interval for the parameter, $\theta$, the test of size $\alpha$ of the hypothesis:
|
||||
\begin{itemize}
|
||||
\item[$H_0$:] $\theta = \theta_0$
|
||||
\item[$H_a$:] $\theta \ne \theta_0$
|
||||
\end{itemize}
|
||||
will lead to a rejection of $H_0$ if and only if $\theta_0$ is not in the 100(1-$\alpha$)\% confidence interval.
|
||||
}
|
||||
|
||||
\ex{}{
|
||||
Consider homework 6, problem 1. We had $\bar{x} = 664$ and $s = 500$. Test the hypothesis:
|
||||
\begin{itemize}
|
||||
\item[$H_0$:] $\mu = 634$
|
||||
\item[$H_a$:] $\mu \ne 634$
|
||||
\item[$\alpha$:] 0.05
|
||||
\end{itemize}
|
||||
|
||||
The 95\% confidence interval for $\mu$:
|
||||
$$\bar{x} \pm t^* {s\over\sqrt{n}}$$
|
||||
$$t^* = 1.961$$
|
||||
$$664 \pm 1.961 {500 \over \sqrt{1700}}$$
|
||||
$$(640.22, 687.78)$$
|
||||
|
||||
Since the value indicated by $H_0$ (634) is not within the 95\% confidence interval, it is not a plausible value for $\mu$, and thus we reject $H_0$ at $\alpha = 0.05$.
|
||||
\\
|
||||
\\
|
||||
Sample evidence suggests that the average number of social ties for a cell phone user is significantly different from 634.
|
||||
}
|
||||
|
||||
\subsection{Confidence Interval for the Difference of Two Means}
|
||||
If $\bar{x}_1$ and $\bar{x}_2$ are the means of independent random samples of size $n_1$ and $n_2$ from approximately normal populations with unknown but equal variances, a 100(1-$\alpha$)\% confidence interval for $\mu_1 - \mu_2$ is given by:
|
||||
|
||||
$$(\bar{x}_1 - \bar{x}_2) \pm t_{\alpha \over 2} s_p \sqrt{{1\over n_1} + {1\over n_2}}$$
|
||||
|
||||
$$s_p^2 = {(n_1-1)s_1^2 + (n_2-1)s_2^2 \over n_1 + n_2 -2}$$
|
||||
Where:
|
||||
\begin{itemize}
|
||||
\item[$t_{\alpha \over 2}$] is the t-value with $n_1 + n_2 - 2$ degrees of freedom
|
||||
\end{itemize}
|
||||
|
||||
\ex{}
|
||||
{
|
||||
Homework 7, problem 3: burn time for fuses.
|
||||
\begin{center}
|
||||
\begin{tabular}{ c | c }
|
||||
Supplier A & Supplier B \\
|
||||
\hline
|
||||
$n_1 = 30$ & $n_2 = 30$ \\
|
||||
$\bar{x}_1 = 30.62$ & $\bar{x}_2 = 31.37$ \\
|
||||
$s_1^2 = 0.384$ & $s_2^2 = 0.185$
|
||||
\end{tabular}
|
||||
\end{center}
|
||||
|
||||
Does the sample suggest that the mean burn time for supplier A is different than that for supplier B? Use $\alpha = 0.05$.
|
||||
|
||||
\begin{itemize}
|
||||
\item[$H_0$:] $\mu_1 = \mu_2$
|
||||
\item[$H_a$:] $\mu_1 \ne \mu_2$
|
||||
\end{itemize}
|
||||
|
||||
The 95\% confidence interval for $\mu_1 - \mu_2$:
|
||||
$$(\bar{x}_1 - \bar{x}_2) \pm t_{\alpha \over 2} s_p \sqrt{{1\over n_1} + {1\over n_2}}$$
|
||||
$$s_p^2 = {(30-1)0.384 + (30-1)0.185 \over 30 + 30 - 2} = 0.2845$$
|
||||
$$\therefore s_p = 0.5334$$
|
||||
$$t_{\alpha \over 2} = 2.002$$
|
||||
$$(30.62 - 31.37) \pm 2.002(0.5534)\sqrt{{1\over30} + {1\over30}}$$
|
||||
$$(-1.02, -0.47)$$
|
||||
|
||||
We are 95\% confident that the difference of mean burn time between supplier A and supplier B is somewhere between -1.02 and -0.47.
|
||||
\\
|
||||
\\
|
||||
Since 0 is not in the confidence interval, we reject $H_0$. Sample evidence suggests that the mean burn time for supplier A is different than that for supplier B.
|
||||
}
|
||||
|
||||
\nt{
|
||||
Since the entire confidence interval is below zero, we conclude with 95\% confidence that $\mu_1 - \mu_2 < 0$ and by extension, $\mu_1 < \mu_2$.
|
||||
}
|
||||
\\
|
||||
\\
|
||||
\noindent
|
||||
The usefulness of using confidence intervals for significance testing:
|
||||
\begin{itemize}
|
||||
\item A confidence interval provides information about the magnitude and direction of the difference between $\mu_1$ and $\mu_2$.
|
||||
\item However, a hypothesis test does not provide such information. It only provides information about significance.
|
||||
\end{itemize}
|
||||
|
||||
\subsection{Paired t-test}
|
||||
Comparing two treatments where observations occur in pairs or are related to each other.
|
||||
|
||||
\ex{}
|
||||
{
|
||||
Two teaching methods to be compared by using 50 students divided into two equal classes.
|
||||
\\
|
||||
\\
|
||||
Method 1:
|
||||
|
||||
Randomly assign 25 students to each class and compare average scores when experiment is concluded.
|
||||
\\
|
||||
\\
|
||||
What if one group gets better students? It would no longer be a fair comparrison of the two methods.
|
||||
In this case, there would be two sources of variation:
|
||||
\begin{enumerate}
|
||||
\item Due to teaching method
|
||||
\item Due to differences between students
|
||||
\end{enumerate}
|
||||
|
||||
This inflates the variance and leads to lower power.
|
||||
\\
|
||||
\\
|
||||
Possible solution:
|
||||
|
||||
Pair students according to preference/ability. This would have mainly variance due to teaching method.
|
||||
}
|
||||
|
||||
\ex{}
|
||||
{
|
||||
10 adult males between the ages of 35 and 50 participated in a study to evaluate the effect of diet and exercise on blood cholesterol levels.
|
||||
|
||||
The total cholesterol was measured in each subject initially and three months after.
|
||||
|
||||
\begin{center}
|
||||
\begin{tabular}{c | c | c | c}
|
||||
Subject & Before & After & Difference\\
|
||||
\hline
|
||||
1 & 265 & 229 & 36 \\
|
||||
2 & 240 & 231 & 9 \\
|
||||
3 & 258 & 227 & 31 \\
|
||||
4 & 295 & 240 & 55 \\
|
||||
5 & 251 & 238 & 13 \\
|
||||
6 & 245 & 241 & 4 \\
|
||||
7 & 287 & 234 & 53 \\
|
||||
8 & 314 & 256 & 58 \\
|
||||
9 & 260 & 247 & 13\\
|
||||
10 & 279 & 239 & 40
|
||||
\end{tabular}
|
||||
\end{center}
|
||||
|
||||
Run a one-sample t-test on the differences:
|
||||
\begin{itemize}
|
||||
\item[$H_0$:] $\mu_d = 0$
|
||||
\item[$H_a$:] $\mu_d \ne 0$
|
||||
\end{itemize}
|
||||
|
||||
Test statistic:
|
||||
$$t^* = {\bar{d} - 0 \over {s_d \over \sqrt{n}}}$$
|
||||
$$\bar{d} = {1\over n} \sum_{i=1}^n d_i$$
|
||||
$$s_d^2 = {1 \over n-1} \sum_{i=1}^n(d_i - \bar{d})^2$$
|
||||
|
||||
Do the data support the claim that the diet and exercise are of value in production of a mean reduction in blood cholesterol levels using $\alpha = 0.05$?
|
||||
|
||||
$$t^* = {31.2 \over {20.43 \over \sqrt{n}}} = 4.829$$
|
||||
The associated p-value is very close to 0. Since the p-value less than $\alpha$, we reject $H_0$. Sample evidence strongly suggests that diet and exercise are of value in producing an effect in blood cholesterol levels.
|
||||
}
|
||||
|
||||
\nt
|
||||
{
|
||||
With the pairing approach, we have our degrees of freedom compared to the two sample approach.
|
||||
\\
|
||||
\\
|
||||
However, if paired observations are highly similar or related, the reduction in variance more than compensates for the loss of degrees of freedom.
|
||||
}
|
||||
|
||||
\section{Analysis of Variance}
|
||||
Consider the problem of deciding whether observed differences among more than two sample means can be attributed to chance, or whether there are real differences among the populations being sampled.
|
||||
|
||||
\begin{itemize}
|
||||
\item[$H_0$:] $\mu_1 = \mu_2 = \cdots = \mu_t$
|
||||
\item[$H_a$:] at least one mean differs.
|
||||
\end{itemize}
|
||||
|
||||
\ex{}
|
||||
{
|
||||
Consider the following observations:
|
||||
\begin{center}
|
||||
\begin{tabular}{c | c | c}
|
||||
Group 1 & Group 2 & Group 3 \\
|
||||
\hline
|
||||
77 & 72 & 76 \\
|
||||
81 & 58 & 85 \\
|
||||
71 & 84 & 82 \\
|
||||
76 & 66 & 80 \\
|
||||
80 & 70 & 88
|
||||
\end{tabular}
|
||||
\end{center}
|
||||
|
||||
Suppose our data can be written as:
|
||||
$$Y_{i j} = \mu_i + \veps_{i j}$$
|
||||
Where:
|
||||
\begin{itemize}
|
||||
\item[$\veps_{i j}$] deviation from the group means
|
||||
\item[$\mu_u$] $i^\text{th}$ group mean
|
||||
\item[$Y_{i j}$] $j^\text{th}$ observation from $i^\text{th}$ group.
|
||||
\end{itemize}
|
||||
|
||||
To infer if at least one $\mu_i$ differs from the others, compare the variance within the groups against the variance between the groups.
|
||||
}
|
||||
\noindent
|
||||
The sum of the observations in the $i^\text{th}$ group:
|
||||
$$y_{i \cdot} = \sum_{j=1}^r y_{i j}$$
|
||||
The overall sum:
|
||||
$$y_{\cdot \cdot} = \sum_{i=1}^t \sum_{j=1}^r y_{i j}$$
|
||||
The mean of observations in the $i^\text{th}$ group:
|
||||
$$\bar{y}_{i \cdot} = {1\over r} \sum_{j = 1}^r y_{i j}$$
|
||||
The overall mean:
|
||||
$$\bar{y}_{\cdot \cdot} = {1 \over r t} \sum_{i=1}^t \sum_{j=1}^r y_{i j}$$
|
||||
|
||||
\noindent
|
||||
Decompose the observation:
|
||||
$$y_{i j} - \bar{y}_{\cdot \cdot} = y_{i j} + \bar{y}_{i \cdot} - \bar{y}_{i \cdot} - \bar{y}_{\cdot \cdot} = (\bar{y}_{i \cdot} - \bar{y}_{\cdot \cdot}) + (y_{i j} - \bar{y}_{i \cdot})$$
|
||||
|
||||
The deviation of an observation from the grand mean is the same as the sum of the deviation of the treatment mean from the grand mean and the deviation of the observation from its treatment mean.
|
||||
|
||||
\thm{}
|
||||
{
|
||||
$$\sum_{i = 1}^t \sum_{j = 1}^r (y_{i j} - \bar{y}_{\cdot \cdot})^2 = r\sum_{i = 1}^t (\bar{y}_c - \bar{y}_{\cdot \cdot})^2 + \sum_{i = 1}^t \sum_{j = 1}^r (y_{i j} - \bar{y}_{i \cdot})^2$$
|
||||
|
||||
The variability of observations about the grand mean is the sum of the variability of treatment means about the grand mean and the variability of observations about their treatment means.
|
||||
|
||||
SSTotal = SSTreatment + SSError
|
||||
}
|
||||
|
||||
\noindent
|
||||
The Anova Table:
|
||||
\begin{center}
|
||||
\begin{tabular}{c | c | c | c}
|
||||
Source of Variation & Sum of Squares & Degrees of Freedom & Mean Squares \\
|
||||
\hline
|
||||
Treatment (between groups) & SSTreat & t - 1 & ${\text{SSTreat} \over t -1}$ \\
|
||||
Error (within groups) & SSE & $t(r - 1)$ & ${\text{SSE} \over t(r-1)}$ \\
|
||||
Total & SSTotal & $tr - 1$
|
||||
\end{tabular}
|
||||
\end{center}
|
||||
|
||||
\nt
|
||||
{
|
||||
\begin{enumerate}
|
||||
\item dfTotal = dfTreatment + dfError
|
||||
\item $\sigma^2$ is estimated by MSE = ${\text{SSE} \over t(r -1)}$ which is a pooled estimate of $\sigma^2$ from all the data in the experiment.
|
||||
\end{enumerate}
|
||||
}
|
||||
|
||||
\subsection{Tests of Hypotheses}
|
||||
\begin{itemize}
|
||||
\item[$H_0$:] $\mu_1 = \mu_2 = \cdots = \mu_t$
|
||||
\item[$H_a$:] at least one mean differs
|
||||
\end{itemize}
|
||||
|
||||
\noindent
|
||||
Assumptions:
|
||||
\begin{enumerate}
|
||||
\item $E[\veps_{i j}] = 0$
|
||||
\item Var$[\veps_{i j}] = \sigma^2$
|
||||
\item Cov$[\veps_{i j}, \veps_{i' j'}] = 0$; $i \ne i'$, $j \ne j'$
|
||||
\item $\veps_{i j}$ has a normal distribution
|
||||
\end{enumerate}
|
||||
|
||||
\noindent
|
||||
Test statistic:
|
||||
$$F = {\text{MSTreat} \over \text{MSE}} \sim F_{t-1, t(r-1)}$$
|
||||
If $H_0$ is true:
|
||||
$$F = {\text{MSTreat} \over \text{MSE}} \approx 1$$
|
||||
If $H_a$ is true, $F_\text{obs} > 1$ and increases as treatment differences increase.
|
||||
P-value:
|
||||
$$P(F_{t-1, t(r-1)} \ge F_\text{obs})$$
|
||||
|
||||
\ex{}
|
||||
{
|
||||
Three types of signals wer utilized in a study to investigate traffic delay. Three types of traffic signals wer utilized in the study:
|
||||
\begin{enumerate}
|
||||
\item pretimesd
|
||||
\item semi-actuated
|
||||
\item fully actuated
|
||||
\end{enumerate}
|
||||
Five intersections were used for each type of signal. The measure of traffic delay used in the study was the average stopped time per vehicle at each intersection. The data are given by:
|
||||
\begin{center}
|
||||
\begin{tabular}{c | c | c}
|
||||
Pretimed & Semi-Actuated & Fully Actuated \\
|
||||
\hline
|
||||
36.6 & 17.5 & 15.0 \\
|
||||
39.2 & 20.6 & 10.4 \\
|
||||
30.4 & 18.7 & 18.9 \\
|
||||
37.1 & 25.7 & 10.5 \\
|
||||
34.1 & 22.0 & 15.2
|
||||
\end{tabular}
|
||||
\end{center}
|
||||
|
||||
Compute the analysis of variance:
|
||||
$$\bar{y}_{\cdot \cdot} = {1 \over 15}(36.6 + 39.2 + \cdots + 15.2) = 23.46$$
|
||||
$$\bar{y}_{1 \cdot} = {1 \over 5}(36.6 + 39.2 + 30.4 + 37.1 + 34.1) = 35.48$$
|
||||
$$\bar{y}_{2 \cdot} = 20.9$$
|
||||
$$\bar{y}_{3 \cdot} = 14$$
|
||||
$$\text{SSTotal} = \sum_{i = 1}^3 \sum_{j=1}^5 (y_{i j} - \bar{y}_{\cdot \cdot})^2 = 1340.456$$
|
||||
$$\text{SSTreat} = 5\sum_{i=1}^3 (\bar{y}_{i \cdot} - \bar{y}_{\cdot \cdot})^2 = 1202.626$$
|
||||
$$\text{SSE} = \text{SSTotal} - \text{SSTreat} = 137.83$$
|
||||
|
||||
\begin{center}
|
||||
\begin{tabular}{c | c | c | c}
|
||||
Source of Variation & Sum of Squares & Degrees of Freedom & Mean of Squares \\
|
||||
\hline
|
||||
Treatments & 1202.626 & 3 - 1 = 2 & 601.313 \\
|
||||
Error & 137.83 & 3(5-1) = 12 & 11.4858 \\
|
||||
Total & 1340.456 & 14
|
||||
\end{tabular}
|
||||
\end{center}
|
||||
|
||||
$$F_\text{obs} = {\text{MSTreat} \over \text{MSE}} = {601.313 \over 11.48} = 52.35$$
|
||||
For such a high observed $F$, the p-value is very close to zero. Sample evidence suggests that the mean delays of the three types of traffic signals differ.
|
||||
}
|
||||
|
||||
\section{Non-Parametric Testing}
|
||||
Most of the hypothesis testing and confidence interval procedures have been based on the assumption that the samples are random from normally distributed populations. These are called parametric methods. Non-parametric or distribution-free methods make no assumptions about the distribution of the underlying population.
|
||||
|
||||
\subsection{The Signed Rank Test}
|
||||
The only assumption is that the data is continuous and comes from a symmetric distribution.
|
||||
|
||||
\begin{enumerate}
|
||||
\item Compute the differences $X_i - \mu_0, i=1\cdots n$.
|
||||
\item Compute the absolute differences $|X_i - \mu_0|$ in ascending order
|
||||
\item Compute $w^+$, the sum of the positive ranks, and $w^-$, the sum of the absulute negative ranks
|
||||
\item The test statistic is given by:
|
||||
$$w^\text{observed} = \min(w^-, w^+)$$
|
||||
\item Use lookup table and reject $H_0$ if $w^\text{observed} \le w_\alpha^*$.
|
||||
\end{enumerate}
|
||||
\\
|
||||
\\
|
||||
\noindent
|
||||
For a one-sided test, if the alternative hypothesis is $\mu > \mu_0$, then $w^\text{observed} = w^-$. If the alternative hypothesis is $\mu < \mu_0$, then $w^\text{observed} = w^+$.
|
||||
|
||||
\ex{}
|
||||
{
|
||||
A report on a study in which a rocket motor is formed by binding an igniter propellant and a sustainer propellant together inside a metal housing. The shear strength of the bond between the two types of propellant types is an important characteristic. The results of testing 10 randomly selected motors are shown below. Do the data suggest that the mean shear strength is different from 2000 psi using $\alpha = 0.05$.
|
||||
|
||||
\begin{center}
|
||||
\begin{tabular}{ c | c | c | c }
|
||||
Observation & $X_i$ & $X_i - \mu_0$ & Rank \\
|
||||
\hline
|
||||
1 & 2158.7 & 157.7 & 2 \\
|
||||
2 & 1678.15 & -321.85 & 8 \\
|
||||
3 & 2316.00 & 316.00 & 7 \\
|
||||
4 & 2016.00 & 16.00 & 1 \\
|
||||
5 & 2207.5 & 207.5 & 3 \\
|
||||
6 & 1708.3 & -291.70 & 6 \\
|
||||
7 & 1784.7 & -215.3 & 4 \\
|
||||
8 & 2575.10 & 575.10 & 10 \\
|
||||
9 & 2357.9 & 357.90 & 8 \\
|
||||
10 & 2256.7 & 256.7 & 5\\
|
||||
\end{tabular}
|
||||
\end{center}
|
||||
|
||||
For this two-sided test:
|
||||
\\
|
||||
$H_0$: $\mu = 2000$
|
||||
\\
|
||||
$H_a$: $\mu \ne 2000$
|
||||
|
||||
The sum of the positive ranks:
|
||||
$$w^+ = 2 + 7 + 1 + 3 + 10 + 9 + 5 = 37$$
|
||||
The sum of the negative ranks:
|
||||
$$w^- = 8 + 6 + 4 = 18$$
|
||||
$$w^\text{observed} = \min(w^-, w^+) = 18$$
|
||||
\\
|
||||
The critical value, $w^*_\alpha$, is found in a lookup table. In this case it is 8. Since the observed test statistic is greater than this critical value, we fail to reject $H_0$. Sample evidence does not suggest that the mean shear strength is different from 2000 psi.
|
||||
}
|
||||
\\
|
||||
\\
|
||||
\noindent
|
||||
Where does $w^*_\alpha$ come from?
|
||||
|
||||
\end{document}
|
@ -0,0 +1,32 @@
|
||||
\contentsline {chapter}{\numberline {1}Probability Density and Cumulative Distribution Functions}{2}{chapter.1}%
|
||||
\contentsline {paragraph}{a)}{3}{section*.2}%
|
||||
\contentsline {paragraph}{b)}{3}{section*.3}%
|
||||
\contentsline {paragraph}{c)}{3}{section*.4}%
|
||||
\contentsline {section}{\numberline {1.1}Continuous Probability Distributions}{3}{section.1.1}%
|
||||
\contentsline {paragraph}{a)}{4}{section*.5}%
|
||||
\contentsline {paragraph}{b)}{5}{section*.6}%
|
||||
\contentsline {chapter}{\numberline {2}Expected Value}{7}{chapter.2}%
|
||||
\contentsline {subsubsection}{Example}{8}{section*.7}%
|
||||
\contentsline {subsubsection}{Properties of Expectations}{8}{section*.8}%
|
||||
\contentsline {subsubsection}{Example}{8}{section*.9}%
|
||||
\contentsline {subsubsection}{Variance of a Random Variable}{8}{section*.10}%
|
||||
\contentsline {subsubsection}{Definition}{8}{section*.11}%
|
||||
\contentsline {subsubsection}{Example}{9}{section*.12}%
|
||||
\contentsline {subsubsection}{Example}{9}{section*.13}%
|
||||
\contentsline {subsubsection}{Theorem}{9}{section*.14}%
|
||||
\contentsline {subsubsection}{Example}{9}{section*.15}%
|
||||
\contentsline {subsection}{\numberline {2.0.1}The Exponential Distribution}{10}{subsection.2.0.1}%
|
||||
\contentsline {paragraph}{Application}{10}{section*.16}%
|
||||
\contentsline {subsubsection}{Example}{10}{section*.17}%
|
||||
\contentsline {subsection}{\numberline {2.0.2}The Normal Distribution}{11}{subsection.2.0.2}%
|
||||
\contentsline {subsubsection}{Definition}{11}{section*.18}%
|
||||
\contentsline {subsubsection}{Example}{11}{section*.19}%
|
||||
\contentsline {subsubsection}{Example}{12}{section*.20}%
|
||||
\contentsline {chapter}{\numberline {3}Hypothesis Testing}{13}{chapter.3}%
|
||||
\contentsline {subsection}{\numberline {3.0.1}Confidence Interval for the Difference of Two Means}{13}{subsection.3.0.1}%
|
||||
\contentsline {subsection}{\numberline {3.0.2}Paired t-test}{14}{subsection.3.0.2}%
|
||||
\contentsline {section}{\numberline {3.1}Analysis of Variance}{16}{section.3.1}%
|
||||
\contentsline {subsection}{\numberline {3.1.1}Tests of Hypotheses}{17}{subsection.3.1.1}%
|
||||
\contentsline {section}{\numberline {3.2}Non-Parametric Testing}{18}{section.3.2}%
|
||||
\contentsline {subsection}{\numberline {3.2.1}The Signed Rank Test}{18}{subsection.3.2.1}%
|
||||
\contentsfinish
|
@ -0,0 +1,178 @@
|
||||
% Things Lie
|
||||
\newcommand{\kb}{\mathfrak b}
|
||||
\newcommand{\kg}{\mathfrak g}
|
||||
\newcommand{\kh}{\mathfrak h}
|
||||
\newcommand{\kn}{\mathfrak n}
|
||||
\newcommand{\ku}{\mathfrak u}
|
||||
\newcommand{\kz}{\mathfrak z}
|
||||
\DeclareMathOperator{\Ext}{Ext} % Ext functor
|
||||
\DeclareMathOperator{\Tor}{Tor} % Tor functor
|
||||
\newcommand{\gl}{\opname{\mathfrak{gl}}} % frak gl group
|
||||
\renewcommand{\sl}{\opname{\mathfrak{sl}}} % frak sl group chktex 6
|
||||
|
||||
% More script letters etc.
|
||||
\newcommand{\SA}{\mathcal A}
|
||||
\newcommand{\SB}{\mathcal B}
|
||||
\newcommand{\SC}{\mathcal C}
|
||||
\newcommand{\SF}{\mathcal F}
|
||||
\newcommand{\SG}{\mathcal G}
|
||||
\newcommand{\SH}{\mathcal H}
|
||||
\newcommand{\OO}{\mathcal O}
|
||||
|
||||
\newcommand{\SCA}{\mathscr A}
|
||||
\newcommand{\SCB}{\mathscr B}
|
||||
\newcommand{\SCC}{\mathscr C}
|
||||
\newcommand{\SCD}{\mathscr D}
|
||||
\newcommand{\SCE}{\mathscr E}
|
||||
\newcommand{\SCF}{\mathscr F}
|
||||
\newcommand{\SCG}{\mathscr G}
|
||||
\newcommand{\SCH}{\mathscr H}
|
||||
|
||||
% Mathfrak primes
|
||||
\newcommand{\km}{\mathfrak m}
|
||||
\newcommand{\kp}{\mathfrak p}
|
||||
\newcommand{\kq}{\mathfrak q}
|
||||
|
||||
% number sets
|
||||
\newcommand{\RR}[1][]{\ensuremath{\ifstrempty{#1}{\mathbb{R}}{\mathbb{R}^{#1}}}}
|
||||
\newcommand{\NN}[1][]{\ensuremath{\ifstrempty{#1}{\mathbb{N}}{\mathbb{N}^{#1}}}}
|
||||
\newcommand{\ZZ}[1][]{\ensuremath{\ifstrempty{#1}{\mathbb{Z}}{\mathbb{Z}^{#1}}}}
|
||||
\newcommand{\QQ}[1][]{\ensuremath{\ifstrempty{#1}{\mathbb{Q}}{\mathbb{Q}^{#1}}}}
|
||||
\newcommand{\CC}[1][]{\ensuremath{\ifstrempty{#1}{\mathbb{C}}{\mathbb{C}^{#1}}}}
|
||||
\newcommand{\PP}[1][]{\ensuremath{\ifstrempty{#1}{\mathbb{P}}{\mathbb{P}^{#1}}}}
|
||||
\newcommand{\HH}[1][]{\ensuremath{\ifstrempty{#1}{\mathbb{H}}{\mathbb{H}^{#1}}}}
|
||||
\newcommand{\FF}[1][]{\ensuremath{\ifstrempty{#1}{\mathbb{F}}{\mathbb{F}^{#1}}}}
|
||||
% expected value
|
||||
\newcommand{\EE}{\ensuremath{\mathbb{E}}}
|
||||
\newcommand{\charin}{\text{ char }}
|
||||
\DeclareMathOperator{\sign}{sign}
|
||||
\DeclareMathOperator{\Aut}{Aut}
|
||||
\DeclareMathOperator{\Inn}{Inn}
|
||||
\DeclareMathOperator{\Syl}{Syl}
|
||||
\DeclareMathOperator{\Gal}{Gal}
|
||||
\DeclareMathOperator{\GL}{GL} % General linear group
|
||||
\DeclareMathOperator{\SL}{SL} % Special linear group
|
||||
|
||||
%---------------------------------------
|
||||
% BlackBoard Math Fonts :-
|
||||
%---------------------------------------
|
||||
|
||||
%Captital Letters
|
||||
\newcommand{\bbA}{\mathbb{A}} \newcommand{\bbB}{\mathbb{B}}
|
||||
\newcommand{\bbC}{\mathbb{C}} \newcommand{\bbD}{\mathbb{D}}
|
||||
\newcommand{\bbE}{\mathbb{E}} \newcommand{\bbF}{\mathbb{F}}
|
||||
\newcommand{\bbG}{\mathbb{G}} \newcommand{\bbH}{\mathbb{H}}
|
||||
\newcommand{\bbI}{\mathbb{I}} \newcommand{\bbJ}{\mathbb{J}}
|
||||
\newcommand{\bbK}{\mathbb{K}} \newcommand{\bbL}{\mathbb{L}}
|
||||
\newcommand{\bbM}{\mathbb{M}} \newcommand{\bbN}{\mathbb{N}}
|
||||
\newcommand{\bbO}{\mathbb{O}} \newcommand{\bbP}{\mathbb{P}}
|
||||
\newcommand{\bbQ}{\mathbb{Q}} \newcommand{\bbR}{\mathbb{R}}
|
||||
\newcommand{\bbS}{\mathbb{S}} \newcommand{\bbT}{\mathbb{T}}
|
||||
\newcommand{\bbU}{\mathbb{U}} \newcommand{\bbV}{\mathbb{V}}
|
||||
\newcommand{\bbW}{\mathbb{W}} \newcommand{\bbX}{\mathbb{X}}
|
||||
\newcommand{\bbY}{\mathbb{Y}} \newcommand{\bbZ}{\mathbb{Z}}
|
||||
|
||||
%---------------------------------------
|
||||
% MathCal Fonts :-
|
||||
%---------------------------------------
|
||||
|
||||
%Captital Letters
|
||||
\newcommand{\mcA}{\mathcal{A}} \newcommand{\mcB}{\mathcal{B}}
|
||||
\newcommand{\mcC}{\mathcal{C}} \newcommand{\mcD}{\mathcal{D}}
|
||||
\newcommand{\mcE}{\mathcal{E}} \newcommand{\mcF}{\mathcal{F}}
|
||||
\newcommand{\mcG}{\mathcal{G}} \newcommand{\mcH}{\mathcal{H}}
|
||||
\newcommand{\mcI}{\mathcal{I}} \newcommand{\mcJ}{\mathcal{J}}
|
||||
\newcommand{\mcK}{\mathcal{K}} \newcommand{\mcL}{\mathcal{L}}
|
||||
\newcommand{\mcM}{\mathcal{M}} \newcommand{\mcN}{\mathcal{N}}
|
||||
\newcommand{\mcO}{\mathcal{O}} \newcommand{\mcP}{\mathcal{P}}
|
||||
\newcommand{\mcQ}{\mathcal{Q}} \newcommand{\mcR}{\mathcal{R}}
|
||||
\newcommand{\mcS}{\mathcal{S}} \newcommand{\mcT}{\mathcal{T}}
|
||||
\newcommand{\mcU}{\mathcal{U}} \newcommand{\mcV}{\mathcal{V}}
|
||||
\newcommand{\mcW}{\mathcal{W}} \newcommand{\mcX}{\mathcal{X}}
|
||||
\newcommand{\mcY}{\mathcal{Y}} \newcommand{\mcZ}{\mathcal{Z}}
|
||||
|
||||
|
||||
%---------------------------------------
|
||||
% Bold Math Fonts :-
|
||||
%---------------------------------------
|
||||
|
||||
%Captital Letters
|
||||
\newcommand{\bmA}{\boldsymbol{A}} \newcommand{\bmB}{\boldsymbol{B}}
|
||||
\newcommand{\bmC}{\boldsymbol{C}} \newcommand{\bmD}{\boldsymbol{D}}
|
||||
\newcommand{\bmE}{\boldsymbol{E}} \newcommand{\bmF}{\boldsymbol{F}}
|
||||
\newcommand{\bmG}{\boldsymbol{G}} \newcommand{\bmH}{\boldsymbol{H}}
|
||||
\newcommand{\bmI}{\boldsymbol{I}} \newcommand{\bmJ}{\boldsymbol{J}}
|
||||
\newcommand{\bmK}{\boldsymbol{K}} \newcommand{\bmL}{\boldsymbol{L}}
|
||||
\newcommand{\bmM}{\boldsymbol{M}} \newcommand{\bmN}{\boldsymbol{N}}
|
||||
\newcommand{\bmO}{\boldsymbol{O}} \newcommand{\bmP}{\boldsymbol{P}}
|
||||
\newcommand{\bmQ}{\boldsymbol{Q}} \newcommand{\bmR}{\boldsymbol{R}}
|
||||
\newcommand{\bmS}{\boldsymbol{S}} \newcommand{\bmT}{\boldsymbol{T}}
|
||||
\newcommand{\bmU}{\boldsymbol{U}} \newcommand{\bmV}{\boldsymbol{V}}
|
||||
\newcommand{\bmW}{\boldsymbol{W}} \newcommand{\bmX}{\boldsymbol{X}}
|
||||
\newcommand{\bmY}{\boldsymbol{Y}} \newcommand{\bmZ}{\boldsymbol{Z}}
|
||||
%Small Letters
|
||||
\newcommand{\bma}{\boldsymbol{a}} \newcommand{\bmb}{\boldsymbol{b}}
|
||||
\newcommand{\bmc}{\boldsymbol{c}} \newcommand{\bmd}{\boldsymbol{d}}
|
||||
\newcommand{\bme}{\boldsymbol{e}} \newcommand{\bmf}{\boldsymbol{f}}
|
||||
\newcommand{\bmg}{\boldsymbol{g}} \newcommand{\bmh}{\boldsymbol{h}}
|
||||
\newcommand{\bmi}{\boldsymbol{i}} \newcommand{\bmj}{\boldsymbol{j}}
|
||||
\newcommand{\bmk}{\boldsymbol{k}} \newcommand{\bml}{\boldsymbol{l}}
|
||||
\newcommand{\bmm}{\boldsymbol{m}} \newcommand{\bmn}{\boldsymbol{n}}
|
||||
\newcommand{\bmo}{\boldsymbol{o}} \newcommand{\bmp}{\boldsymbol{p}}
|
||||
\newcommand{\bmq}{\boldsymbol{q}} \newcommand{\bmr}{\boldsymbol{r}}
|
||||
\newcommand{\bms}{\boldsymbol{s}} \newcommand{\bmt}{\boldsymbol{t}}
|
||||
\newcommand{\bmu}{\boldsymbol{u}} \newcommand{\bmv}{\boldsymbol{v}}
|
||||
\newcommand{\bmw}{\boldsymbol{w}} \newcommand{\bmx}{\boldsymbol{x}}
|
||||
\newcommand{\bmy}{\boldsymbol{y}} \newcommand{\bmz}{\boldsymbol{z}}
|
||||
|
||||
%---------------------------------------
|
||||
% Scr Math Fonts :-
|
||||
%---------------------------------------
|
||||
|
||||
\newcommand{\sA}{{\mathscr{A}}} \newcommand{\sB}{{\mathscr{B}}}
|
||||
\newcommand{\sC}{{\mathscr{C}}} \newcommand{\sD}{{\mathscr{D}}}
|
||||
\newcommand{\sE}{{\mathscr{E}}} \newcommand{\sF}{{\mathscr{F}}}
|
||||
\newcommand{\sG}{{\mathscr{G}}} \newcommand{\sH}{{\mathscr{H}}}
|
||||
\newcommand{\sI}{{\mathscr{I}}} \newcommand{\sJ}{{\mathscr{J}}}
|
||||
\newcommand{\sK}{{\mathscr{K}}} \newcommand{\sL}{{\mathscr{L}}}
|
||||
\newcommand{\sM}{{\mathscr{M}}} \newcommand{\sN}{{\mathscr{N}}}
|
||||
\newcommand{\sO}{{\mathscr{O}}} \newcommand{\sP}{{\mathscr{P}}}
|
||||
\newcommand{\sQ}{{\mathscr{Q}}} \newcommand{\sR}{{\mathscr{R}}}
|
||||
\newcommand{\sS}{{\mathscr{S}}} \newcommand{\sT}{{\mathscr{T}}}
|
||||
\newcommand{\sU}{{\mathscr{U}}} \newcommand{\sV}{{\mathscr{V}}}
|
||||
\newcommand{\sW}{{\mathscr{W}}} \newcommand{\sX}{{\mathscr{X}}}
|
||||
\newcommand{\sY}{{\mathscr{Y}}} \newcommand{\sZ}{{\mathscr{Z}}}
|
||||
|
||||
|
||||
%---------------------------------------
|
||||
% Math Fraktur Font
|
||||
%---------------------------------------
|
||||
|
||||
%Captital Letters
|
||||
\newcommand{\mfA}{\mathfrak{A}} \newcommand{\mfB}{\mathfrak{B}}
|
||||
\newcommand{\mfC}{\mathfrak{C}} \newcommand{\mfD}{\mathfrak{D}}
|
||||
\newcommand{\mfE}{\mathfrak{E}} \newcommand{\mfF}{\mathfrak{F}}
|
||||
\newcommand{\mfG}{\mathfrak{G}} \newcommand{\mfH}{\mathfrak{H}}
|
||||
\newcommand{\mfI}{\mathfrak{I}} \newcommand{\mfJ}{\mathfrak{J}}
|
||||
\newcommand{\mfK}{\mathfrak{K}} \newcommand{\mfL}{\mathfrak{L}}
|
||||
\newcommand{\mfM}{\mathfrak{M}} \newcommand{\mfN}{\mathfrak{N}}
|
||||
\newcommand{\mfO}{\mathfrak{O}} \newcommand{\mfP}{\mathfrak{P}}
|
||||
\newcommand{\mfQ}{\mathfrak{Q}} \newcommand{\mfR}{\mathfrak{R}}
|
||||
\newcommand{\mfS}{\mathfrak{S}} \newcommand{\mfT}{\mathfrak{T}}
|
||||
\newcommand{\mfU}{\mathfrak{U}} \newcommand{\mfV}{\mathfrak{V}}
|
||||
\newcommand{\mfW}{\mathfrak{W}} \newcommand{\mfX}{\mathfrak{X}}
|
||||
\newcommand{\mfY}{\mathfrak{Y}} \newcommand{\mfZ}{\mathfrak{Z}}
|
||||
%Small Letters
|
||||
\newcommand{\mfa}{\mathfrak{a}} \newcommand{\mfb}{\mathfrak{b}}
|
||||
\newcommand{\mfc}{\mathfrak{c}} \newcommand{\mfd}{\mathfrak{d}}
|
||||
\newcommand{\mfe}{\mathfrak{e}} \newcommand{\mff}{\mathfrak{f}}
|
||||
\newcommand{\mfg}{\mathfrak{g}} \newcommand{\mfh}{\mathfrak{h}}
|
||||
\newcommand{\mfi}{\mathfrak{i}} \newcommand{\mfj}{\mathfrak{j}}
|
||||
\newcommand{\mfk}{\mathfrak{k}} \newcommand{\mfl}{\mathfrak{l}}
|
||||
\newcommand{\mfm}{\mathfrak{m}} \newcommand{\mfn}{\mathfrak{n}}
|
||||
\newcommand{\mfo}{\mathfrak{o}} \newcommand{\mfp}{\mathfrak{p}}
|
||||
\newcommand{\mfq}{\mathfrak{q}} \newcommand{\mfr}{\mathfrak{r}}
|
||||
\newcommand{\mfs}{\mathfrak{s}} \newcommand{\mft}{\mathfrak{t}}
|
||||
\newcommand{\mfu}{\mathfrak{u}} \newcommand{\mfv}{\mathfrak{v}}
|
||||
\newcommand{\mfw}{\mathfrak{w}} \newcommand{\mfx}{\mathfrak{x}}
|
||||
\newcommand{\mfy}{\mathfrak{y}} \newcommand{\mfz}{\mathfrak{z}}
|
@ -0,0 +1,88 @@
|
||||
%From M275 "Topology" at SJSU
|
||||
\newcommand{\id}{\mathrm{id}}
|
||||
\newcommand{\taking}[1]{\xrightarrow{#1}}
|
||||
\newcommand{\inv}{^{-1}}
|
||||
|
||||
%From M170 "Introduction to Graph Theory" at SJSU
|
||||
\DeclareMathOperator{\diam}{diam}
|
||||
\DeclareMathOperator{\ord}{ord}
|
||||
\newcommand{\defeq}{\overset{\mathrm{def}}{=}}
|
||||
|
||||
%From the USAMO .tex files
|
||||
\newcommand{\ts}{\textsuperscript}
|
||||
\newcommand{\dg}{^\circ}
|
||||
\newcommand{\ii}{\item}
|
||||
|
||||
% % From Math 55 and Math 145 at Harvard
|
||||
% \newenvironment{subproof}[1][Proof]{%
|
||||
% \begin{proof}[#1] \renewcommand{\qedsymbol}{$\blacksquare$}}%
|
||||
% {\end{proof}}
|
||||
|
||||
\newcommand{\liff}{\leftrightarrow}
|
||||
\newcommand{\lthen}{\rightarrow}
|
||||
\newcommand{\opname}{\operatorname}
|
||||
\newcommand{\surjto}{\twoheadrightarrow}
|
||||
\newcommand{\injto}{\hookrightarrow}
|
||||
\newcommand{\On}{\mathrm{On}} % ordinals
|
||||
\DeclareMathOperator{\img}{im} % Image
|
||||
\DeclareMathOperator{\Img}{Im} % Image
|
||||
\DeclareMathOperator{\coker}{coker} % Cokernel
|
||||
\DeclareMathOperator{\Coker}{Coker} % Cokernel
|
||||
\DeclareMathOperator{\Ker}{Ker} % Kernel
|
||||
\DeclareMathOperator{\rank}{rank}
|
||||
\DeclareMathOperator{\Spec}{Spec} % spectrum
|
||||
\DeclareMathOperator{\Tr}{Tr} % trace
|
||||
\DeclareMathOperator{\pr}{pr} % projection
|
||||
\DeclareMathOperator{\ext}{ext} % extension
|
||||
\DeclareMathOperator{\pred}{pred} % predecessor
|
||||
\DeclareMathOperator{\dom}{dom} % domain
|
||||
\DeclareMathOperator{\ran}{ran} % range
|
||||
\DeclareMathOperator{\Hom}{Hom} % homomorphism
|
||||
\DeclareMathOperator{\Mor}{Mor} % morphisms
|
||||
\DeclareMathOperator{\End}{End} % endomorphism
|
||||
|
||||
\newcommand{\eps}{\epsilon}
|
||||
\newcommand{\veps}{\varepsilon}
|
||||
\newcommand{\ol}{\overline}
|
||||
\newcommand{\ul}{\underline}
|
||||
\newcommand{\wt}{\widetilde}
|
||||
\newcommand{\wh}{\widehat}
|
||||
\newcommand{\vocab}[1]{\textbf{\color{blue} #1}}
|
||||
\providecommand{\half}{\frac{1}{2}}
|
||||
\newcommand{\dang}{\measuredangle} %% Directed angle
|
||||
\newcommand{\ray}[1]{\overrightarrow{#1}}
|
||||
\newcommand{\seg}[1]{\overline{#1}}
|
||||
\newcommand{\arc}[1]{\wideparen{#1}}
|
||||
\DeclareMathOperator{\cis}{cis}
|
||||
\DeclareMathOperator*{\lcm}{lcm}
|
||||
\DeclareMathOperator*{\argmin}{arg min}
|
||||
\DeclareMathOperator*{\argmax}{arg max}
|
||||
\newcommand{\cycsum}{\sum_{\mathrm{cyc}}}
|
||||
\newcommand{\symsum}{\sum_{\mathrm{sym}}}
|
||||
\newcommand{\cycprod}{\prod_{\mathrm{cyc}}}
|
||||
\newcommand{\symprod}{\prod_{\mathrm{sym}}}
|
||||
\newcommand{\Qed}{\begin{flushright}\qed\end{flushright}}
|
||||
\newcommand{\parinn}{\setlength{\parindent}{1cm}}
|
||||
\newcommand{\parinf}{\setlength{\parindent}{0cm}}
|
||||
% \newcommand{\norm}{\|\cdot\|}
|
||||
\newcommand{\inorm}{\norm_{\infty}}
|
||||
\newcommand{\opensets}{\{V_{\alpha}\}_{\alpha\in I}}
|
||||
\newcommand{\oset}{V_{\alpha}}
|
||||
\newcommand{\opset}[1]{V_{\alpha_{#1}}}
|
||||
\newcommand{\lub}{\text{lub}}
|
||||
\newcommand{\del}[2]{\frac{\partial #1}{\partial #2}}
|
||||
\newcommand{\Del}[3]{\frac{\partial^{#1} #2}{\partial^{#1} #3}}
|
||||
\newcommand{\deld}[2]{\dfrac{\partial #1}{\partial #2}}
|
||||
\newcommand{\Deld}[3]{\dfrac{\partial^{#1} #2}{\partial^{#1} #3}}
|
||||
\newcommand{\lm}{\lambda}
|
||||
\newcommand{\uin}{\mathbin{\rotatebox[origin=c]{90}{$\in$}}}
|
||||
\newcommand{\usubset}{\mathbin{\rotatebox[origin=c]{90}{$\subset$}}}
|
||||
\newcommand{\lt}{\left}
|
||||
\newcommand{\rt}{\right}
|
||||
\newcommand{\bs}[1]{\boldsymbol{#1}}
|
||||
\newcommand{\exs}{\exists}
|
||||
\newcommand{\st}{\strut}
|
||||
\newcommand{\dps}[1]{\displaystyle{#1}}
|
||||
|
||||
\newcommand{\sol}{\setlength{\parindent}{0cm}\textbf{\textit{Solution:}}\setlength{\parindent}{1cm} }
|
||||
\newcommand{\solve}[1]{\setlength{\parindent}{0cm}\textbf{\textit{Solution: }}\setlength{\parindent}{1cm}#1 \Qed}
|
779
5th-Semester-Fall-2023/Prob-and-Stat-for-ECEs/Notes/preamble.tex
Normal file
779
5th-Semester-Fall-2023/Prob-and-Stat-for-ECEs/Notes/preamble.tex
Normal file
@ -0,0 +1,779 @@
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
% PACKAGE IMPORTS
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
|
||||
\usepackage[tmargin=2cm,rmargin=1in,lmargin=1in,margin=0.85in,bmargin=2cm,footskip=.2in]{geometry}
|
||||
\usepackage{amsmath,amsfonts,amsthm,amssymb,mathtools}
|
||||
\usepackage{listings}
|
||||
\usepackage[varbb]{newpxmath}
|
||||
\usepackage{xfrac}
|
||||
\usepackage[makeroom]{cancel}
|
||||
\usepackage{mathtools}
|
||||
\usepackage{bookmark}
|
||||
\usepackage{enumitem}
|
||||
\usepackage{hyperref,theoremref}
|
||||
\hypersetup{
|
||||
pdftitle={Assignment},
|
||||
colorlinks=true, linkcolor=doc!90,
|
||||
bookmarksnumbered=true,
|
||||
bookmarksopen=true
|
||||
}
|
||||
\usepackage[most,many,breakable]{tcolorbox}
|
||||
\usepackage{xcolor}
|
||||
\usepackage{varwidth}
|
||||
\usepackage{varwidth}
|
||||
\usepackage{etoolbox}
|
||||
%\usepackage{authblk}
|
||||
\usepackage{nameref}
|
||||
\usepackage{multicol,array}
|
||||
\usepackage{tikz-cd}
|
||||
\usepackage[ruled,vlined,linesnumbered]{algorithm2e}
|
||||
\usepackage{comment} % enables the use of multi-line comments (\ifx \fi)
|
||||
\usepackage{import}
|
||||
\usepackage{xifthen}
|
||||
\usepackage{pdfpages}
|
||||
\usepackage{transparent}
|
||||
|
||||
\newcommand\mycommfont[1]{\footnotesize\ttfamily\textcolor{blue}{#1}}
|
||||
\SetCommentSty{mycommfont}
|
||||
\newcommand{\incfig}[1]{%
|
||||
\def\svgwidth{\columnwidth}
|
||||
\import{./figures/}{#1.pdf_tex}
|
||||
}
|
||||
|
||||
\usepackage{tikzsymbols}
|
||||
\renewcommand\qedsymbol{$\Laughey$}
|
||||
|
||||
|
||||
%\usepackage{import}
|
||||
%\usepackage{xifthen}
|
||||
%\usepackage{pdfpages}
|
||||
%\usepackage{transparent}
|
||||
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
% SELF MADE COLORS
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
|
||||
|
||||
\definecolor{myg}{RGB}{56, 140, 70}
|
||||
\definecolor{myb}{RGB}{45, 111, 177}
|
||||
\definecolor{myr}{RGB}{199, 68, 64}
|
||||
\definecolor{mytheorembg}{HTML}{F2F2F9}
|
||||
\definecolor{mytheoremfr}{HTML}{00007B}
|
||||
\definecolor{mylenmabg}{HTML}{FFFAF8}
|
||||
\definecolor{mylenmafr}{HTML}{983b0f}
|
||||
\definecolor{mypropbg}{HTML}{f2fbfc}
|
||||
\definecolor{mypropfr}{HTML}{191971}
|
||||
\definecolor{myexamplebg}{HTML}{F2FBF8}
|
||||
\definecolor{myexamplefr}{HTML}{88D6D1}
|
||||
\definecolor{myexampleti}{HTML}{2A7F7F}
|
||||
\definecolor{mydefinitbg}{HTML}{E5E5FF}
|
||||
\definecolor{mydefinitfr}{HTML}{3F3FA3}
|
||||
\definecolor{notesgreen}{RGB}{0,162,0}
|
||||
\definecolor{myp}{RGB}{197, 92, 212}
|
||||
\definecolor{mygr}{HTML}{2C3338}
|
||||
\definecolor{myred}{RGB}{127,0,0}
|
||||
\definecolor{myyellow}{RGB}{169,121,69}
|
||||
\definecolor{myexercisebg}{HTML}{F2FBF8}
|
||||
\definecolor{myexercisefg}{HTML}{88D6D1}
|
||||
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
% TCOLORBOX SETUPS
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
\setlength{\parindent}{1cm}
|
||||
%================================
|
||||
% THEOREM BOX
|
||||
%================================
|
||||
|
||||
\tcbuselibrary{theorems,skins,hooks}
|
||||
\newtcbtheorem[number within=section]{Theorem}{Theorem}
|
||||
{%
|
||||
enhanced,
|
||||
breakable,
|
||||
colback = mytheorembg,
|
||||
frame hidden,
|
||||
boxrule = 0sp,
|
||||
borderline west = {2pt}{0pt}{mytheoremfr},
|
||||
sharp corners,
|
||||
detach title,
|
||||
before upper = \tcbtitle\par\smallskip,
|
||||
coltitle = mytheoremfr,
|
||||
fonttitle = \bfseries\sffamily,
|
||||
description font = \mdseries,
|
||||
separator sign none,
|
||||
segmentation style={solid, mytheoremfr},
|
||||
}
|
||||
{th}
|
||||
|
||||
\tcbuselibrary{theorems,skins,hooks}
|
||||
\newtcbtheorem[number within=chapter]{theorem}{Theorem}
|
||||
{%
|
||||
enhanced,
|
||||
breakable,
|
||||
colback = mytheorembg,
|
||||
frame hidden,
|
||||
boxrule = 0sp,
|
||||
borderline west = {2pt}{0pt}{mytheoremfr},
|
||||
sharp corners,
|
||||
detach title,
|
||||
before upper = \tcbtitle\par\smallskip,
|
||||
coltitle = mytheoremfr,
|
||||
fonttitle = \bfseries\sffamily,
|
||||
description font = \mdseries,
|
||||
separator sign none,
|
||||
segmentation style={solid, mytheoremfr},
|
||||
}
|
||||
{th}
|
||||
|
||||
|
||||
\tcbuselibrary{theorems,skins,hooks}
|
||||
\newtcolorbox{Theoremcon}
|
||||
{%
|
||||
enhanced
|
||||
,breakable
|
||||
,colback = mytheorembg
|
||||
,frame hidden
|
||||
,boxrule = 0sp
|
||||
,borderline west = {2pt}{0pt}{mytheoremfr}
|
||||
,sharp corners
|
||||
,description font = \mdseries
|
||||
,separator sign none
|
||||
}
|
||||
|
||||
%================================
|
||||
% Corollery
|
||||
%================================
|
||||
\tcbuselibrary{theorems,skins,hooks}
|
||||
\newtcbtheorem[number within=section]{Corollary}{Corollary}
|
||||
{%
|
||||
enhanced
|
||||
,breakable
|
||||
,colback = myp!10
|
||||
,frame hidden
|
||||
,boxrule = 0sp
|
||||
,borderline west = {2pt}{0pt}{myp!85!black}
|
||||
,sharp corners
|
||||
,detach title
|
||||
,before upper = \tcbtitle\par\smallskip
|
||||
,coltitle = myp!85!black
|
||||
,fonttitle = \bfseries\sffamily
|
||||
,description font = \mdseries
|
||||
,separator sign none
|
||||
,segmentation style={solid, myp!85!black}
|
||||
}
|
||||
{th}
|
||||
\tcbuselibrary{theorems,skins,hooks}
|
||||
\newtcbtheorem[number within=chapter]{corollary}{Corollary}
|
||||
{%
|
||||
enhanced
|
||||
,breakable
|
||||
,colback = myp!10
|
||||
,frame hidden
|
||||
,boxrule = 0sp
|
||||
,borderline west = {2pt}{0pt}{myp!85!black}
|
||||
,sharp corners
|
||||
,detach title
|
||||
,before upper = \tcbtitle\par\smallskip
|
||||
,coltitle = myp!85!black
|
||||
,fonttitle = \bfseries\sffamily
|
||||
,description font = \mdseries
|
||||
,separator sign none
|
||||
,segmentation style={solid, myp!85!black}
|
||||
}
|
||||
{th}
|
||||
|
||||
|
||||
%================================
|
||||
% LENMA
|
||||
%================================
|
||||
|
||||
\tcbuselibrary{theorems,skins,hooks}
|
||||
\newtcbtheorem[number within=section]{Review}{Review}
|
||||
{%
|
||||
enhanced,
|
||||
breakable,
|
||||
colback = mylenmabg,
|
||||
frame hidden,
|
||||
boxrule = 0sp,
|
||||
borderline west = {2pt}{0pt}{mylenmafr},
|
||||
sharp corners,
|
||||
detach title,
|
||||
before upper = \tcbtitle\par\smallskip,
|
||||
coltitle = mylenmafr,
|
||||
fonttitle = \bfseries\sffamily,
|
||||
description font = \mdseries,
|
||||
separator sign none,
|
||||
segmentation style={solid, mylenmafr},
|
||||
}
|
||||
{th}
|
||||
|
||||
\tcbuselibrary{theorems,skins,hooks}
|
||||
\newtcbtheorem[number within=chapter]{review}{Review}
|
||||
{%
|
||||
enhanced,
|
||||
breakable,
|
||||
colback = mylenmabg,
|
||||
frame hidden,
|
||||
boxrule = 0sp,
|
||||
borderline west = {2pt}{0pt}{mylenmafr},
|
||||
sharp corners,
|
||||
detach title,
|
||||
before upper = \tcbtitle\par\smallskip,
|
||||
coltitle = mylenmafr,
|
||||
fonttitle = \bfseries\sffamily,
|
||||
description font = \mdseries,
|
||||
separator sign none,
|
||||
segmentation style={solid, mylenmafr},
|
||||
}
|
||||
{th}
|
||||
|
||||
|
||||
%================================
|
||||
% METHOD
|
||||
%================================
|
||||
|
||||
\tcbuselibrary{theorems,skins,hooks}
|
||||
\newtcbtheorem[number within=section]{Method}{Method}
|
||||
{%
|
||||
enhanced,
|
||||
breakable,
|
||||
colback = mypropbg,
|
||||
frame hidden,
|
||||
boxrule = 0sp,
|
||||
borderline west = {2pt}{0pt}{mypropfr},
|
||||
sharp corners,
|
||||
detach title,
|
||||
before upper = \tcbtitle\par\smallskip,
|
||||
coltitle = mypropfr,
|
||||
fonttitle = \bfseries\sffamily,
|
||||
description font = \mdseries,
|
||||
separator sign none,
|
||||
segmentation style={solid, mypropfr},
|
||||
}
|
||||
{th}
|
||||
|
||||
\tcbuselibrary{theorems,skins,hooks}
|
||||
\newtcbtheorem[number within=chapter]{method}{Method}
|
||||
{%
|
||||
enhanced,
|
||||
breakable,
|
||||
colback = mypropbg,
|
||||
frame hidden,
|
||||
boxrule = 0sp,
|
||||
borderline west = {2pt}{0pt}{mypropfr},
|
||||
sharp corners,
|
||||
detach title,
|
||||
before upper = \tcbtitle\par\smallskip,
|
||||
coltitle = mypropfr,
|
||||
fonttitle = \bfseries\sffamily,
|
||||
description font = \mdseries,
|
||||
separator sign none,
|
||||
segmentation style={solid, mypropfr},
|
||||
}
|
||||
{th}
|
||||
|
||||
|
||||
%================================
|
||||
% CLAIM
|
||||
%================================
|
||||
|
||||
\tcbuselibrary{theorems,skins,hooks}
|
||||
\newtcbtheorem[number within=section]{claim}{Claim}
|
||||
{%
|
||||
enhanced
|
||||
,breakable
|
||||
,colback = myg!10
|
||||
,frame hidden
|
||||
,boxrule = 0sp
|
||||
,borderline west = {2pt}{0pt}{myg}
|
||||
,sharp corners
|
||||
,detach title
|
||||
,before upper = \tcbtitle\par\smallskip
|
||||
,coltitle = myg!85!black
|
||||
,fonttitle = \bfseries\sffamily
|
||||
,description font = \mdseries
|
||||
,separator sign none
|
||||
,segmentation style={solid, myg!85!black}
|
||||
}
|
||||
{th}
|
||||
|
||||
|
||||
|
||||
%================================
|
||||
% Exercise
|
||||
%================================
|
||||
|
||||
\tcbuselibrary{theorems,skins,hooks}
|
||||
\newtcbtheorem[number within=section]{Exercise}{Exercise}
|
||||
{%
|
||||
enhanced,
|
||||
breakable,
|
||||
colback = myexercisebg,
|
||||
frame hidden,
|
||||
boxrule = 0sp,
|
||||
borderline west = {2pt}{0pt}{myexercisefg},
|
||||
sharp corners,
|
||||
detach title,
|
||||
before upper = \tcbtitle\par\smallskip,
|
||||
coltitle = myexercisefg,
|
||||
fonttitle = \bfseries\sffamily,
|
||||
description font = \mdseries,
|
||||
separator sign none,
|
||||
segmentation style={solid, myexercisefg},
|
||||
}
|
||||
{th}
|
||||
|
||||
\tcbuselibrary{theorems,skins,hooks}
|
||||
\newtcbtheorem[number within=chapter]{exercise}{Exercise}
|
||||
{%
|
||||
enhanced,
|
||||
breakable,
|
||||
colback = myexercisebg,
|
||||
frame hidden,
|
||||
boxrule = 0sp,
|
||||
borderline west = {2pt}{0pt}{myexercisefg},
|
||||
sharp corners,
|
||||
detach title,
|
||||
before upper = \tcbtitle\par\smallskip,
|
||||
coltitle = myexercisefg,
|
||||
fonttitle = \bfseries\sffamily,
|
||||
description font = \mdseries,
|
||||
separator sign none,
|
||||
segmentation style={solid, myexercisefg},
|
||||
}
|
||||
{th}
|
||||
|
||||
%================================
|
||||
% EXAMPLE BOX
|
||||
%================================
|
||||
|
||||
\newtcbtheorem[number within=section]{Example}{Example}
|
||||
{%
|
||||
colback = myexamplebg
|
||||
,breakable
|
||||
,colframe = myexamplefr
|
||||
,coltitle = myexampleti
|
||||
,boxrule = 1pt
|
||||
,sharp corners
|
||||
,detach title
|
||||
,before upper=\tcbtitle\par\smallskip
|
||||
,fonttitle = \bfseries
|
||||
,description font = \mdseries
|
||||
,separator sign none
|
||||
,description delimiters parenthesis
|
||||
}
|
||||
{ex}
|
||||
|
||||
\newtcbtheorem[number within=chapter]{example}{Example}
|
||||
{%
|
||||
colback = myexamplebg
|
||||
,breakable
|
||||
,colframe = myexamplefr
|
||||
,coltitle = myexampleti
|
||||
,boxrule = 1pt
|
||||
,sharp corners
|
||||
,detach title
|
||||
,before upper=\tcbtitle\par\smallskip
|
||||
,fonttitle = \bfseries
|
||||
,description font = \mdseries
|
||||
,separator sign none
|
||||
,description delimiters parenthesis
|
||||
}
|
||||
{ex}
|
||||
|
||||
%================================
|
||||
% DEFINITION BOX
|
||||
%================================
|
||||
|
||||
\newtcbtheorem[number within=section]{Definition}{Definition}{enhanced,
|
||||
before skip=2mm,after skip=2mm, colback=red!5,colframe=red!80!black,boxrule=0.5mm,
|
||||
attach boxed title to top left={xshift=1cm,yshift*=1mm-\tcboxedtitleheight}, varwidth boxed title*=-3cm,
|
||||
boxed title style={frame code={
|
||||
\path[fill=tcbcolback]
|
||||
([yshift=-1mm,xshift=-1mm]frame.north west)
|
||||
arc[start angle=0,end angle=180,radius=1mm]
|
||||
([yshift=-1mm,xshift=1mm]frame.north east)
|
||||
arc[start angle=180,end angle=0,radius=1mm];
|
||||
\path[left color=tcbcolback!60!black,right color=tcbcolback!60!black,
|
||||
middle color=tcbcolback!80!black]
|
||||
([xshift=-2mm]frame.north west) -- ([xshift=2mm]frame.north east)
|
||||
[rounded corners=1mm]-- ([xshift=1mm,yshift=-1mm]frame.north east)
|
||||
-- (frame.south east) -- (frame.south west)
|
||||
-- ([xshift=-1mm,yshift=-1mm]frame.north west)
|
||||
[sharp corners]-- cycle;
|
||||
},interior engine=empty,
|
||||
},
|
||||
fonttitle=\bfseries,
|
||||
title={#2},#1}{def}
|
||||
\newtcbtheorem[number within=chapter]{definition}{Definition}{enhanced,
|
||||
before skip=2mm,after skip=2mm, colback=red!5,colframe=red!80!black,boxrule=0.5mm,
|
||||
attach boxed title to top left={xshift=1cm,yshift*=1mm-\tcboxedtitleheight}, varwidth boxed title*=-3cm,
|
||||
boxed title style={frame code={
|
||||
\path[fill=tcbcolback]
|
||||
([yshift=-1mm,xshift=-1mm]frame.north west)
|
||||
arc[start angle=0,end angle=180,radius=1mm]
|
||||
([yshift=-1mm,xshift=1mm]frame.north east)
|
||||
arc[start angle=180,end angle=0,radius=1mm];
|
||||
\path[left color=tcbcolback!60!black,right color=tcbcolback!60!black,
|
||||
middle color=tcbcolback!80!black]
|
||||
([xshift=-2mm]frame.north west) -- ([xshift=2mm]frame.north east)
|
||||
[rounded corners=1mm]-- ([xshift=1mm,yshift=-1mm]frame.north east)
|
||||
-- (frame.south east) -- (frame.south west)
|
||||
-- ([xshift=-1mm,yshift=-1mm]frame.north west)
|
||||
[sharp corners]-- cycle;
|
||||
},interior engine=empty,
|
||||
},
|
||||
fonttitle=\bfseries,
|
||||
title={#2},#1}{def}
|
||||
|
||||
|
||||
|
||||
%================================
|
||||
% Solution BOX
|
||||
%================================
|
||||
|
||||
\makeatletter
|
||||
\newtcbtheorem{question}{Question}{enhanced,
|
||||
breakable,
|
||||
colback=white,
|
||||
colframe=myb!80!black,
|
||||
attach boxed title to top left={yshift*=-\tcboxedtitleheight},
|
||||
fonttitle=\bfseries,
|
||||
title={#2},
|
||||
boxed title size=title,
|
||||
boxed title style={%
|
||||
sharp corners,
|
||||
rounded corners=northwest,
|
||||
colback=tcbcolframe,
|
||||
boxrule=0pt,
|
||||
},
|
||||
underlay boxed title={%
|
||||
\path[fill=tcbcolframe] (title.south west)--(title.south east)
|
||||
to[out=0, in=180] ([xshift=5mm]title.east)--
|
||||
(title.center-|frame.east)
|
||||
[rounded corners=\kvtcb@arc] |-
|
||||
(frame.north) -| cycle;
|
||||
},
|
||||
#1
|
||||
}{def}
|
||||
\makeatother
|
||||
|
||||
%================================
|
||||
% SOLUTION BOX
|
||||
%================================
|
||||
|
||||
\makeatletter
|
||||
\newtcolorbox{solution}{enhanced,
|
||||
breakable,
|
||||
colback=white,
|
||||
colframe=myg!80!black,
|
||||
attach boxed title to top left={yshift*=-\tcboxedtitleheight},
|
||||
title=Solution,
|
||||
boxed title size=title,
|
||||
boxed title style={%
|
||||
sharp corners,
|
||||
rounded corners=northwest,
|
||||
colback=tcbcolframe,
|
||||
boxrule=0pt,
|
||||
},
|
||||
underlay boxed title={%
|
||||
\path[fill=tcbcolframe] (title.south west)--(title.south east)
|
||||
to[out=0, in=180] ([xshift=5mm]title.east)--
|
||||
(title.center-|frame.east)
|
||||
[rounded corners=\kvtcb@arc] |-
|
||||
(frame.north) -| cycle;
|
||||
},
|
||||
}
|
||||
\makeatother
|
||||
|
||||
%================================
|
||||
% Question BOX
|
||||
%================================
|
||||
|
||||
\makeatletter
|
||||
\newtcbtheorem{qstion}{Question}{enhanced,
|
||||
breakable,
|
||||
colback=white,
|
||||
colframe=mygr,
|
||||
attach boxed title to top left={yshift*=-\tcboxedtitleheight},
|
||||
fonttitle=\bfseries,
|
||||
title={#2},
|
||||
boxed title size=title,
|
||||
boxed title style={%
|
||||
sharp corners,
|
||||
rounded corners=northwest,
|
||||
colback=tcbcolframe,
|
||||
boxrule=0pt,
|
||||
},
|
||||
underlay boxed title={%
|
||||
\path[fill=tcbcolframe] (title.south west)--(title.south east)
|
||||
to[out=0, in=180] ([xshift=5mm]title.east)--
|
||||
(title.center-|frame.east)
|
||||
[rounded corners=\kvtcb@arc] |-
|
||||
(frame.north) -| cycle;
|
||||
},
|
||||
#1
|
||||
}{def}
|
||||
\makeatother
|
||||
|
||||
\newtcbtheorem[number within=chapter]{wconc}{Wrong Concept}{
|
||||
breakable,
|
||||
enhanced,
|
||||
colback=white,
|
||||
colframe=myr,
|
||||
arc=0pt,
|
||||
outer arc=0pt,
|
||||
fonttitle=\bfseries\sffamily\large,
|
||||
colbacktitle=myr,
|
||||
attach boxed title to top left={},
|
||||
boxed title style={
|
||||
enhanced,
|
||||
skin=enhancedfirst jigsaw,
|
||||
arc=3pt,
|
||||
bottom=0pt,
|
||||
interior style={fill=myr}
|
||||
},
|
||||
#1
|
||||
}{def}
|
||||
|
||||
|
||||
|
||||
%================================
|
||||
% NOTE BOX
|
||||
%================================
|
||||
|
||||
\usetikzlibrary{arrows,calc,shadows.blur}
|
||||
\tcbuselibrary{skins}
|
||||
\newtcolorbox{note}[1][]{%
|
||||
enhanced jigsaw,
|
||||
colback=gray!20!white,%
|
||||
colframe=gray!80!black,
|
||||
size=small,
|
||||
boxrule=1pt,
|
||||
title=\textbf{Note:},
|
||||
halign title=flush center,
|
||||
coltitle=black,
|
||||
breakable,
|
||||
drop shadow=black!50!white,
|
||||
attach boxed title to top left={xshift=1cm,yshift=-\tcboxedtitleheight/2,yshifttext=-\tcboxedtitleheight/2},
|
||||
minipage boxed title=1.5cm,
|
||||
boxed title style={%
|
||||
colback=white,
|
||||
size=fbox,
|
||||
boxrule=1pt,
|
||||
boxsep=2pt,
|
||||
underlay={%
|
||||
\coordinate (dotA) at ($(interior.west) + (-0.5pt,0)$);
|
||||
\coordinate (dotB) at ($(interior.east) + (0.5pt,0)$);
|
||||
\begin{scope}
|
||||
\clip (interior.north west) rectangle ([xshift=3ex]interior.east);
|
||||
\filldraw [white, blur shadow={shadow opacity=60, shadow yshift=-.75ex}, rounded corners=2pt] (interior.north west) rectangle (interior.south east);
|
||||
\end{scope}
|
||||
\begin{scope}[gray!80!black]
|
||||
\fill (dotA) circle (2pt);
|
||||
\fill (dotB) circle (2pt);
|
||||
\end{scope}
|
||||
},
|
||||
},
|
||||
#1,
|
||||
}
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
% SELF MADE COMMANDS
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
|
||||
\newcommand{\thm}[2]{\begin{Theorem}{#1}{}#2\end{Theorem}}
|
||||
\newcommand{\cor}[2]{\begin{Corollary}{#1}{}#2\end{Corollary}}
|
||||
\newcommand{\rvw}[2]{\begin{Review}{#1}{}#2\end{Review}}
|
||||
\newcommand{\mthd}[2]{\begin{Method}{#1}{}#2\end{Method}}
|
||||
\newcommand{\clm}[3]{\begin{claim}{#1}{#2}#3\end{claim}}
|
||||
\newcommand{\wc}[2]{\begin{wconc}{#1}{}\setlength{\parindent}{1cm}#2\end{wconc}}
|
||||
\newcommand{\thmcon}[1]{\begin{Theoremcon}{#1}\end{Theoremcon}}
|
||||
\newcommand{\ex}[2]{\begin{Example}{#1}{}#2\end{Example}}
|
||||
\newcommand{\dfn}[2]{\begin{Definition}[colbacktitle=red!75!black]{#1}{}#2\end{Definition}}
|
||||
\newcommand{\dfnc}[2]{\begin{definition}[colbacktitle=red!75!black]{#1}{}#2\end{definition}}
|
||||
\newcommand{\qs}[2]{\begin{question}{#1}{}#2\end{question}}
|
||||
\newcommand{\pf}[2]{\begin{myproof}[#1]#2\end{myproof}}
|
||||
\newcommand{\nt}[1]{\begin{note}#1\end{note}}
|
||||
|
||||
\newcommand*\circled[1]{\tikz[baseline=(char.base)]{
|
||||
\node[shape=circle,draw,inner sep=1pt] (char) {#1};}}
|
||||
\newcommand\getcurrentref[1]{%
|
||||
\ifnumequal{\value{#1}}{0}
|
||||
{??}
|
||||
{\the\value{#1}}%
|
||||
}
|
||||
\newcommand{\getCurrentSectionNumber}{\getcurrentref{section}}
|
||||
\newenvironment{myproof}[1][\proofname]{%
|
||||
\proof[\bfseries #1: ]%
|
||||
}{\endproof}
|
||||
|
||||
\newcommand{\mclm}[2]{\begin{myclaim}[#1]#2\end{myclaim}}
|
||||
\newenvironment{myclaim}[1][\claimname]{\proof[\bfseries #1: ]}{}
|
||||
|
||||
\newcounter{mylabelcounter}
|
||||
|
||||
\makeatletter
|
||||
\newcommand{\setword}[2]{%
|
||||
\phantomsection
|
||||
#1\def\@currentlabel{\unexpanded{#1}}\label{#2}%
|
||||
}
|
||||
\makeatother
|
||||
|
||||
|
||||
|
||||
|
||||
\tikzset{
|
||||
symbol/.style={
|
||||
draw=none,
|
||||
every to/.append style={
|
||||
edge node={node [sloped, allow upside down, auto=false]{$#1$}}}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
% deliminators
|
||||
\DeclarePairedDelimiter{\abs}{\lvert}{\rvert}
|
||||
\DeclarePairedDelimiter{\norm}{\lVert}{\rVert}
|
||||
|
||||
\DeclarePairedDelimiter{\ceil}{\lceil}{\rceil}
|
||||
\DeclarePairedDelimiter{\floor}{\lfloor}{\rfloor}
|
||||
\DeclarePairedDelimiter{\round}{\lfloor}{\rceil}
|
||||
|
||||
\newsavebox\diffdbox
|
||||
\newcommand{\slantedromand}{{\mathpalette\makesl{d}}}
|
||||
\newcommand{\makesl}[2]{%
|
||||
\begingroup
|
||||
\sbox{\diffdbox}{$\mathsurround=0pt#1\mathrm{#2}$}%
|
||||
\pdfsave
|
||||
\pdfsetmatrix{1 0 0.2 1}%
|
||||
\rlap{\usebox{\diffdbox}}%
|
||||
\pdfrestore
|
||||
\hskip\wd\diffdbox
|
||||
\endgroup
|
||||
}
|
||||
\newcommand{\dd}[1][]{\ensuremath{\mathop{}\!\ifstrempty{#1}{%
|
||||
\slantedromand\@ifnextchar^{\hspace{0.2ex}}{\hspace{0.1ex}}}%
|
||||
{\slantedromand\hspace{0.2ex}^{#1}}}}
|
||||
\ProvideDocumentCommand\dv{o m g}{%
|
||||
\ensuremath{%
|
||||
\IfValueTF{#3}{%
|
||||
\IfNoValueTF{#1}{%
|
||||
\frac{\dd #2}{\dd #3}%
|
||||
}{%
|
||||
\frac{\dd^{#1} #2}{\dd #3^{#1}}%
|
||||
}%
|
||||
}{%
|
||||
\IfNoValueTF{#1}{%
|
||||
\frac{\dd}{\dd #2}%
|
||||
}{%
|
||||
\frac{\dd^{#1}}{\dd #2^{#1}}%
|
||||
}%
|
||||
}%
|
||||
}%
|
||||
}
|
||||
\providecommand*{\pdv}[3][]{\frac{\partial^{#1}#2}{\partial#3^{#1}}}
|
||||
% - others
|
||||
\DeclareMathOperator{\Lap}{\mathcal{L}}
|
||||
\DeclareMathOperator{\Var}{Var} % varience
|
||||
\DeclareMathOperator{\Cov}{Cov} % covarience
|
||||
\DeclareMathOperator{\E}{E} % expected
|
||||
|
||||
% Since the amsthm package isn't loaded
|
||||
|
||||
% I prefer the slanted \leq
|
||||
\let\oldleq\leq % save them in case they're every wanted
|
||||
\let\oldgeq\geq
|
||||
\renewcommand{\leq}{\leqslant}
|
||||
\renewcommand{\geq}{\geqslant}
|
||||
|
||||
% % redefine matrix env to allow for alignment, use r as default
|
||||
% \renewcommand*\env@matrix[1][r]{\hskip -\arraycolsep
|
||||
% \let\@ifnextchar\new@ifnextchar
|
||||
% \array{*\c@MaxMatrixCols #1}}
|
||||
|
||||
|
||||
%\usepackage{framed}
|
||||
%\usepackage{titletoc}
|
||||
%\usepackage{etoolbox}
|
||||
%\usepackage{lmodern}
|
||||
|
||||
|
||||
%\patchcmd{\tableofcontents}{\contentsname}{\sffamily\contentsname}{}{}
|
||||
|
||||
%\renewenvironment{leftbar}
|
||||
%{\def\FrameCommand{\hspace{6em}%
|
||||
% {\color{myyellow}\vrule width 2pt depth 6pt}\hspace{1em}}%
|
||||
% \MakeFramed{\parshape 1 0cm \dimexpr\textwidth-6em\relax\FrameRestore}\vskip2pt%
|
||||
%}
|
||||
%{\endMakeFramed}
|
||||
|
||||
%\titlecontents{chapter}
|
||||
%[0em]{\vspace*{2\baselineskip}}
|
||||
%{\parbox{4.5em}{%
|
||||
% \hfill\Huge\sffamily\bfseries\color{myred}\thecontentspage}%
|
||||
% \vspace*{-2.3\baselineskip}\leftbar\textsc{\small\chaptername~\thecontentslabel}\\\sffamily}
|
||||
%{}{\endleftbar}
|
||||
%\titlecontents{section}
|
||||
%[8.4em]
|
||||
%{\sffamily\contentslabel{3em}}{}{}
|
||||
%{\hspace{0.5em}\nobreak\itshape\color{myred}\contentspage}
|
||||
%\titlecontents{subsection}
|
||||
%[8.4em]
|
||||
%{\sffamily\contentslabel{3em}}{}{}
|
||||
%{\hspace{0.5em}\nobreak\itshape\color{myred}\contentspage}
|
||||
|
||||
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
% TABLE OF CONTENTS
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
\usepackage{tikz}
|
||||
\definecolor{doc}{RGB}{0,60,110}
|
||||
\usepackage{titletoc}
|
||||
\contentsmargin{0cm}
|
||||
\titlecontents{chapter}[3.7pc]
|
||||
{\addvspace{30pt}%
|
||||
\begin{tikzpicture}[remember picture, overlay]%
|
||||
\draw[fill=doc!60,draw=doc!60] (-7,-.1) rectangle (-0.9,.5);%
|
||||
\pgftext[left,x=-3.5cm,y=0.2cm]{\color{white}\Large\sc\bfseries Chapter\ \thecontentslabel};%
|
||||
\end{tikzpicture}\color{doc!60}\large\sc\bfseries}%
|
||||
{}
|
||||
{}
|
||||
{\;\titlerule\;\large\sc\bfseries Page \thecontentspage
|
||||
\begin{tikzpicture}[remember picture, overlay]
|
||||
\draw[fill=doc!60,draw=doc!60] (2pt,0) rectangle (4,0.1pt);
|
||||
\end{tikzpicture}}%
|
||||
\titlecontents{section}[3.7pc]
|
||||
{\addvspace{2pt}}
|
||||
{\contentslabel[\thecontentslabel]{2pc}}
|
||||
{}
|
||||
{\hfill\small \thecontentspage}
|
||||
[]
|
||||
\titlecontents*{subsection}[3.7pc]
|
||||
{\addvspace{-1pt}\small}
|
||||
{}
|
||||
{}
|
||||
{\ --- \small\thecontentspage}
|
||||
[ \textbullet\ ][]
|
||||
|
||||
\makeatletter
|
||||
\renewcommand{\tableofcontents}{%
|
||||
\chapter*{%
|
||||
\vspace*{-20\p@}%
|
||||
\begin{tikzpicture}[remember picture, overlay]%
|
||||
\pgftext[right,x=15cm,y=0.2cm]{\color{doc!60}\Huge\sc\bfseries \contentsname};%
|
||||
\draw[fill=doc!60,draw=doc!60] (13,-.75) rectangle (20,1);%
|
||||
\clip (13,-.75) rectangle (20,1);
|
||||
\pgftext[right,x=15cm,y=0.2cm]{\color{white}\Huge\sc\bfseries \contentsname};%
|
||||
\end{tikzpicture}}%
|
||||
\@starttoc{toc}}
|
||||
\makeatother
|
||||
|
@ -0,0 +1,21 @@
|
||||
This is pdfTeX, Version 3.141592653-2.6-1.40.24 (TeX Live 2022/CVE-2023-32700 patched) (preloaded format=pdflatex 2023.9.26) 10 NOV 2023 09:55
|
||||
entering extended mode
|
||||
restricted \write18 enabled.
|
||||
%&-line parsing enabled.
|
||||
**
|
||||
|
||||
! Emergency stop.
|
||||
<*>
|
||||
|
||||
End of file on the terminal!
|
||||
|
||||
|
||||
Here is how much of TeX's memory you used:
|
||||
4 strings out of 476182
|
||||
134 string characters out of 5796581
|
||||
1848793 words of memory out of 6000000
|
||||
20414 multiletter control sequences out of 15000+600000
|
||||
512287 words of font info for 32 fonts, out of 8000000 for 9000
|
||||
1137 hyphenation exceptions out of 8191
|
||||
0i,0n,0p,22b,6s stack positions out of 10000i,1000n,20000p,200000b,200000s
|
||||
! ==> Fatal error occurred, no output PDF file produced!
|
Reference in New Issue
Block a user