Skip to content

Commit

Permalink
C3 w1 (#34)
Browse files Browse the repository at this point in the history
* new changes
  • Loading branch information
akkefa committed Sep 22, 2022
1 parent 4b42566 commit cb97816
Show file tree
Hide file tree
Showing 7 changed files with 120 additions and 233 deletions.
1 change: 0 additions & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ Contents
probability/random_variable
probability/discrete_distributions
probability/continuous_distributions
probability/continuous_random_variables
probability/joint_distributions
probability/covariance_and_correlation
probability/estimators_and_sampling_distributions
Expand Down
2 changes: 1 addition & 1 deletion docs/probability/continuous_distributions.md
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ samples then the mean of the samples will end up being very close to normality.

:::

### PDF
### Probability Density Function
If we plot the normal distribution density function, it’s curve has the following characteristics:

```{image} https://miro.medium.com/max/1400/0*8ZymFK4ust4AgKyc.png
Expand Down
226 changes: 0 additions & 226 deletions docs/probability/continuous_random_variables.rst

This file was deleted.

80 changes: 79 additions & 1 deletion docs/probability/hypothesis_testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,82 @@ kernelspec:
```{title} What is hypothesis testing?
```

# Hypothesis Testing
# Hypothesis Testing

## What is Hypothesis Testing?
- Hypothesis testing is an act in statistics whereby an analyst tests an assumption regarding a population parameter.
- Hypothesis testing is a formal procedure for investigating our ideas about the world using statistics. It is most
often used by scientists to test specific predictions, called hypotheses, that arise from theories.


### Steps

There are 5 main steps in hypothesis testing:

1. State your research hypothesis as a null hypothesis and alternate hypothesis (Ho) and (Ha or H1).
2. Collect data in a way designed to test the hypothesis.
3. Perform an appropriate statistical test.
4. Decide whether to reject or fail to reject your null hypothesis.
5. Present the findings in your results and discussion section.

#### State your null and alternate hypothesis
After developing your initial research hypothesis it is important to restate it as a null ($H_0$) and alternate ($H_1$)
hypothesis so that you can test it mathematically.

- The alternate hypothesis is usually your initial hypothesis that predicts a relationship between variables.
- The null hypothesis is a prediction of no relationship between the variables you are interested in.

You want to test whether there is a relationship between gender and height. Based on your knowledge of human physiology,
you formulate a hypothesis that men are, on average, taller than women. To test this hypothesis, you restate it as:

Ho: Men are, on average, not taller than women.
Ha: Men are, on average, taller than women.

##### Example
Let $X_1, X_2, \ldots, X_n$ be a random sample from the normal distribution with mean $\mu$ and variance $\sigma^2$

Example of random sample after it is observed:

$$
2.73,1.14,3.98,2.15,5,85,1.97,2.54,2.03
$$

Based on what you are seeing, do you believe that the true population mean $\mu$ is

$$
\begin{align}
\mu<=3 \\
or \\
\mu>3 \\
\text { The sample is } \overline{\mathrm{x}}=2.799
\end{align}
$$


The Sample mean is

$$
\bar{x}=\frac{1}{n} \sum_{i=11}^n X_i
$$

- We're going to tend to think that $\mu<3$ when $\bar{X}$ is "significantly" smaller than 3.
- We're going to tend to think that $\mu>3$ when $\bar{X}$ is "significantly" larger than 3.
- We're never going to observe $\bar{X}=3$, but we may be able to be convinced that $\mu=3$ if $\bar{X}$ is not too far away.

Hypotheses:

$\mathrm{H}_0: \mu \leq 3$
$\mathrm{H}_1: \mu>3 \quad$ alternate

hypothesis
- The null hypothesis is assumed to be true.
- The alternate hypothesis is what we are out to show.

Conclusion is either:
Reject $\mathrm{H}_0 \quad$ OR $\quad$ Fail to Reject $\mathrm{H}_0$

#### Errors in Hypothesis Testing

##### Type I Error
37 changes: 36 additions & 1 deletion docs/probability/random_variable.md
Original file line number Diff line number Diff line change
Expand Up @@ -474,4 +474,39 @@ The indicator function of a subset A of a set X is a function.

$\text{Indicator function}_{A}(X) = \mathbf{1}_A(x) =\begin{cases} 1, & \text { if } A \cap X \neq \emptyset \\ 0, & \text { otherwise }\end{cases}$

Notation= $\mathbb{1} _{A}(x)$
Notation= $\mathbb{1} _{A}(x)$

## Random Sample

A collection of random variables is independent and identically distributed if each random variable has the same
probability distribution as the others and all are mutually independent.

$$
\large \text{Random Sample} = $X_1, X_2, X_3, ..., X_n
$$

Suppose that $X_1, X_2, X_3, ..., X_n$ is a random sample from the Normal distribution with parameters
$\mu$ and $sigma^2$. **Mu and sigma are same for all random variables**

$$
X_{1},X_{2}, \ldots, X_{n} \stackrel{\mathrm{iid}}{\sim} N(\mu, \sigma^{2})
$$

Suppose that $X_1, X_2, X_3, ..., X_n$ is a random sample from the gamma distribution with parameters
$alpha$ and $\beta$.

$$
X_{1},X_{2}, \ldots, X_{n} \stackrel{\mathrm{iid}}{\sim} \Gamma(\alpha, \beta)
$$

### Example

A good example is a succession of throws of a fair coin: The coin has no memory, so all the throws are **independent**.
And every throw is 50:50 (heads:tails), so the coin is and stays fair - the distribution from which every throw is
drawn, so to speak, is and stays the same: **identically distributed**.

### Independent and identically distributed random variables (IID)

```{centered} Random Sample == IID
```

6 changes: 3 additions & 3 deletions docs/probability/what_is_probability.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ kernelspec:

- Probability is the branch of mathematics that deals with the occurrence of a random event.
- Probability is the measure of the likelihood of an event to happen.
- Probability means possibility and probability is the study of randomness and uncertainty.

Probability theory is widely used in the area of studies such as statistics, finance, gambling, artificial intelligence,
machine learning, computer science, game theory, and philosophy.
probability is the study of randomness and uncertainty. Probability theory is widely used in the area of studies such
as statistics, finance, gambling, artificial intelligence, machine learning, computer science, game theory, and
philosophy.

### Applications of probability

Expand Down
1 change: 1 addition & 0 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
torch~=1.12
seaborn~=0.11
scipy~=1.9
myst-nb~=0.16
sphinx-design~=0.2
sphinx-copybutton

0 comments on commit cb97816

Please sign in to comment.