## MATH 185 – Take-Home Exam 1

### Due Sunday, May 5th, by 11:59 PM

** AGREEMENT**

**By taking this exam, you agree to ****not**** discuss the exam with anyone, starting now, neither with a classmate or anyone else, neither in person nor through other means, including electronic. Please do ****not**** post questions on Piazza. Unless otherwise speci- fied, it is acceptable to copy-paste from the lecture or homework solution code.**

** Problem 1. (Student vs Wilcoxon) **Suppose we have a numerical sample of size

*which we assume was generated iid from an underlying distribution*

*n**, unknown with a well-defined mean*

*F**.*

*µ**• Student’s t-test *is a test about the mean: Is

*equal to a given value*

*µ*

*µ*_{0}?

*• Wicoxon’s signed-rank test *is a test for symmetry: Is

*symmetric about a given*

*F*

*µ*_{0}?

That being said, the t-test can be used to test whether * F *is symmetric about

*µ*_{0}, based on the fact that ‘symmetric about

*µ*_{0}’ implies that ‘the mean is equal to

*µ*_{0}’. However, the two are not equivalent, so that the t-test is not consistent against all alternatives. Conversely, for the signed- rank test to be useful as a test about the mean, we need to assume that

*is symmetric about its mean. With this additional (and nontrivial) assumption on*

*F**, testing for symmetry about*

*F*

*µ*_{0}is equivalent to testing whether the mean equal to

*µ*_{0}. (Convince yourself of that.) In what follows, we place ourselves in that situation, so that we can directly compare the two tests. There is some theory on that. For example, it is known that when

*is a normal distribution, in which case the t-test achieves the most power asymptotically (meaning in the large-sample limit), the signed-rank test performs almost as well. We want to evaluate that with simulations.*

*F*Since both tests are scale-free, we may take that * F *to be the normal distribution with mean

*and variance 1. We consider the two-sided setting where we test*

*µ**= 0 versus*

*µ**= 0. For each*

*µ ƒ**10*

*n ∈ {**20*

*,**50*

*,**100*

*,**200*

*,**500*

*,**do the following. For each*

*}**in a grid of your choice, denoted*

*µ**and of size 10, generate*

*M*

*X*_{1}

*(*

*, . . . , X*_{n}*∼ N**1) and apply the t-test and signed-rank test, both set at level*

*µ,**= 0*

*α**10. Record whether they reject or not. Repeat this*

*.**= 1*

*B**000 times and compute the fraction of times each test rejects. This estimates the power of each test against the alternative*

*,**. The end result is a plot where these estimated power curves for each of these two tests are overlaid. Use colors and a legend to identify the two curves. Make sure to choose*

*µ**so that we can see the power go from about*

*M**to about 1, zooming in on the action.*

*α** Note. *When this problem is completed, you will have generated 6 plots all together, each with the estimated power curves for the two tests.)

** Problem 2. (Fungi in brassica plants) **Consider the following article about how different brassica plants are affected by different types of Rhizoctonia fungi.

^{1}Read enough of the article to understand the premise and the main findings. Otherwise, we will focus on the data given in Table 6 on how different brassica species are affected by different types of Rhizoctonia fungi.

A. Write a function tableObsExp(dat) taking in a two-column data frame, with each column repre- senting a factor, and then outputting a table of observed and expected (under no association) of counts — similar to what Table 6 in that article looks like.

B. Enter the observed counts from Table 6 (likely by hand, as the data do not seem directly downloadable) and apply your function to recover a similar table.

C. Continuing with the same dataset, produce a couple of plots using functions in the ggplot2.

D. Finally, ask a question and formalize it into a hypothesis testing problem. Perform a test and offer some brief comments.

The article was published in the scientific journal * PLOS ONE *and is available online at the following address

https://journals.plos.org/plosone/article?id=10.1371/journal.pone.0111750