 # Problem 1. (Goodness-of-fit testing in multiple samples) Suppose we...

## Question

Problem 1. (Goodness-of-fit testing in multiple samples) Suppose we have multiple numer- ical samples. Let Yij denote the ith observation in group j, where i = 1,...,nj and j = 1,...,J. We want to test the null hypothesis that the samples come from the same distribution.
A. Write a function permSST(y, g, B = 999) which takes in the observations as a numerical vector y of size n1 + · · · + nJ and the corresponding group labels as a vector g taking values in {1,...,J}, and also the number of repeats B, and returns the Monte Carlo permutation p-value for the treatment sum of squares. [You may want to write a function to compute that sum, so that the code is cleaner.]
B. Consider the situation where we have J groups of same size n1 = ··· = nJ = m. The jth sample is drawn from the normal distribution with mean θj and variance 1. As an alternative, choose θj = jτ, where τ > 0. (The larger τ is, the farther the alternative is from the null.) Record the p-value corresponding to the ANOVA F-test (the one that assumes equal variances) and record the p-value returned by your permSST function. Do this for J ∈ {2, 5, 10}, m ∈ {10, 30, 100}, and five carefully chosen values of τ , and repeat each setting M = 200 times. In the same plot, for each of the two tests, graph the p-value (averaged over the M repeats) as a function of τ . (Thus you will end up generating 3 × 3 = 9 such plots in total.) The range of τ should be such that the average p-values are clearly seen to change with τ. Offer some brief comments.

## Solution Preview

These solutions may offer step-by-step problem-solving explanations or good writing examples that include modern styles of formatting and construction of bibliographies out of text citations and references. Students may use these solutions for personal skill-building and practice. Unethical use is strictly forbidden.

By purchasing this solution you'll be able to access the following files:
Solution.zip.

\$40.00
for this solution

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

### Find A Tutor

View available Statistics-R Programming Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.