Note this homeowrk is due **Friday** at midnight.

Submit your answers on canvas.

# 1. Exact Binomial test

As we saw in lecture `binom.test()`

performs an exact binomial test.

Use

`binom.test()`

to perform a two-sided test of the null hypothesis that \(p = 0.6\) when you observe \(X = 8\) successes in \(n = 15\) trials. What is the reported p-value?Confirm that the p-value from (a) agrees with the method discussed in class: use

`dbinom()`

to find the probabilities of each outcome \(X = 0, 1, 2,\ldots, 15\) and add up the probabilities of outcomes as likely as or less likely than \(X = 8\) when \(p = 0.6\).Based on the p-value from part (a), would you reject the null hypothesis \(H_0: p = 0.6\) vs. \(H_A: p \ne 0.6\) at level \(\alpha = 0.05\)?

In class we found a rough confidence interval by inverting the exact test (Q8 from the worksheet on Oct 13th). Use

`binom.test()`

and a sequence of \(p_0\) to emulate this procedure in R to find a 95% confidence interval for \(p\) up to 2 decimal places of precision.

# 2. Data Analysis

Using the same `brfss`

data as in HW #3.

Estimate the proportion of US residents who are in the overweight or obese categories based on body mass index (BMI \(= \frac{\text{weight in kg}} {(\text{height in m})^2} > 25\)).

**Write a statistical summary of your findings**Is the median desired weight loss greater than zero for US females? What is a likely range for the median desired weight loss.

**Conduct the appropriate analyses and write a statistical summary of your findings**(Hint: if observed values take the exact value of the hypothesized median, you will need to drop them before proceeding with the sign test.)A colleague suggests testing that median desired loss is zero with a Wilcoxon Signed Rank test. Write a two to three sentence argument for why this is not appropriate in this case.

# 3. The Approximate Binomial test

In lecture we saw both the “Exact Binomial Test” and the “Approximate Binomial Test”. Recall you can get the approximate test p-value in R with `prop.test()`

and the exact p-value from `binom.test()`

.

We also saw a rough guideline, that if \(np > 5\) and \(n(1-p) > 5\), the approximate test should be a good approximation the the exact test.

Your task for this question is to investigate this guideline through simulation. Perform simulations to assess the Type I error rate of the two procedures for a range of \(np\) (i.e. set \(p\) and vary \(n\), or set \(n\) and vary \(p\)). **Does the guideline seem reasonable?**