程序代写代做代考 Computer Lab Week 10

Computer Lab Week 10
STAT221
Hypothesis testing using a parametric t-test
Consider the sample, xi ∈ {1.5, 3.0, 2.2, 2.5, 4.1, 3.7}.
1. Test the hypothesis
H1: μ>2
by writing the R code needed to perform a t-test, but without using the R function t.test(). Can
the null-hypothesis be rejected at a type-I-error rate of α = 0.05?
2. Modify the above code to test the alternative hypothesis
H1: μ̸=2.
Compare with the previous one-sided hypothesis and test decision.
Hypothesis testing using a permutation test
Generate two normally distributed random samples
Xi ∼ Normal(μX = 0,σX = 1)
and
Yj ∼ Normal(μY = 1.5, σY = 2)
1. Perform a one-sided t-test (using α = 0.05) to test if μX < μY without using the function t.test(). with sample sizes nX = nY = 4. 2. Write the R code to perform a permutation test for the t-test statistic and compare the resulting p-value with the p-value of the t-test. 3. By creating a suitable plot, compare the sampling distribution of the test statistic (plotted as a histogram, say) with the density of a t-distribution (plotted by adding a curve to the histogram). 4. Create plots for different sample sizes, nX and nY , e.g. 5, 10, 25, 50, 100, and with a range of different seeds used for the random number generation. 1