5th semester files

This commit is contained in:
2024-02-22 14:23:12 -05:00
parent e39a9fec53
commit 5223b711a6
727 changed files with 1836099 additions and 0 deletions

View File

@ -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.
![](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$$
### 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$$

View File

@ -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\]

View File

@ -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
```

View File

@ -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}

View File

@ -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()
```
![](ConfidenceInterval.png)
## 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$.

View File

@ -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

View File

@ -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

View File

@ -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}

View File

@ -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

View File

@ -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}}

View File

@ -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}

View 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

View File

@ -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!