---
title: "Multiple Testing Lab (stub)"
format: html
---

Stub of the Multiple Testing Lab page: the exercises, without the solutions. Solutions: https://morrison-lab.github.io/lds/chapters/multiple-testing-lab.html

#### Lab: the first manager's returns

Use the [`Fund` data](#dat-fund).
What are the [sample mean](https://morrison-lab.github.io/sds/exploratory-descriptive.html#def-sample-mean) and [sample standard deviation](https://morrison-lab.github.io/sds/exploratory-descriptive.html#def-sample-sd) of the excess returns of `Manager1`?

::: {.callout-tip}

#### Hint

[Read the file](https://morrison-lab.github.io/lds/chapters/programming-primer.html#exm-prog-pandas) into a table,
then apply a summary function to one column.

:::

```{python}
# your code here
```

#### Lab: a histogram of the managers' mean returns

Use the [`Fund` data](#dat-fund).
Draw a histogram of the [sample mean](https://morrison-lab.github.io/sds/exploratory-descriptive.html#def-sample-mean) excess return of each of the managers.

::: {.callout-tip}

#### Hint

[Summarize each column](https://morrison-lab.github.io/lds/chapters/programming-primer.html#exm-prog-pandas) of the table to get one value per manager,
then [draw a histogram](https://morrison-lab.github.io/lds/chapters/programming-primer.html#exm-prog-plots) of those values.

:::

```{python}
# your code here
```

#### Lab: test the first manager

Use the [`Fund` data](#dat-fund).
Run a [one-sample $t$-test](https://morrison-lab.github.io/sds/basic-statistical-methods.html#def-one-sample-t-test) of the [null hypothesis](https://morrison-lab.github.io/sds/inference.html#def-null-hypothesis) that `Manager1` has no skill.
What is the [$p$-value](https://morrison-lab.github.io/sds/inference.html#def-p-value)?

::: {.callout-tip}

#### Hint

The [`scipy.stats` module](https://morrison-lab.github.io/lds/chapters/programming-primer.html#exm-prog-scipy) has a $t$-test in Python,
while R has `t.test()`.

:::

```{python}
# your code here
```

#### Lab: test every manager

Use the [`Fund` data](#dat-fund).
Run the test of Exercise 3 for each of the managers,
then count the managers whose [$p$-value](https://morrison-lab.github.io/sds/inference.html#def-p-value) is below $0.05$.

::: {.callout-tip}

#### Hint

The [test routine](https://morrison-lab.github.io/lds/chapters/programming-primer.html#exm-prog-scipy) in Python takes a whole table plus an axis,
while in R you can [apply](https://morrison-lab.github.io/lds/chapters/programming-primer.html#exm-prog-tidyverse-more) the test to each column.

:::

```{python}
# your code here
```

#### Lab: the Bonferroni correction

Use the [$p$-values](https://morrison-lab.github.io/sds/inference.html#def-p-value) of Exercise 4.
Apply the [Bonferroni correction](https://morrison-lab.github.io/sds/multiple-testing.html#def-bonferroni) to hold the [family-wise error rate](https://morrison-lab.github.io/sds/multiple-testing.html#def-fwer) at $0.05$.
How many managers does it reject?

::: {.callout-tip}

#### Hint

Multiply each $p$-value by the count of tests,
then [compare it](https://morrison-lab.github.io/lds/chapters/programming-primer.html#exm-prog-pandas) with $0.05$.
In R, `p.adjust()` does the multiplication.

:::

```{python}
# your code here
```

#### Lab: the Benjamini–Hochberg procedure

Use the [$p$-values](https://morrison-lab.github.io/sds/inference.html#def-p-value) of Exercise 4.
Apply the [Benjamini–Hochberg procedure](https://morrison-lab.github.io/sds/multiple-testing.html#thm-bh-fdr) to hold the [false discovery rate](https://morrison-lab.github.io/sds/multiple-testing.html#def-fdr) at $0.1$.
How many managers does it reject?

::: {.callout-tip}

#### Hint

The [`scipy.stats` module](https://morrison-lab.github.io/lds/chapters/programming-primer.html#exm-prog-scipy) adjusts $p$-values in Python,
while R's `p.adjust()` takes the method `"BH"`.

:::

```{python}
# your code here
```
