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 PreviewSolution 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:

    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.

    Upload a file
    Continue without uploading

    We couldn't find that subject.
    Please select the best match from the list below.

    We'll send you an email right away. If it's not in your inbox, check your spam folder.

    • 1
    • 2
    • 3
    Live Chats