Answered step by step
Verified Expert Solution
Question
1 Approved Answer
6. Suppose YN(,0) and Y N(2,0),i=1,...,n. j = 1,...,n, where Y's and Y2's are all independent. Here, the variances and are unknown, but ==.
6. Suppose YN(,0) and Y N(2,0),i=1,...,n. j = 1,...,n, where Y's and Y2's are all independent. Here, the variances and are unknown, but ==. We would like to conduct a two-sample t-test to see if = . We would also like to construct a 100(1-a)% confidence interval for 1-2. Define your notations clearly and answer the following questions. (a) State the null and alternative hypotheses. Note that there are three possible alternatives. (b) Let s and be the sample variances. Write the pooled variance estimate for (c) Write the test statistic and its null distribution. (d) For each alternative, write the p-value and explain how to draw a conclusion based on it at the significance level a. 4 (e) Construct a 100(1 - a)% confidence interval for 1-2. You do not need to consider a one-sided confidence bound. (f) Write a function to conduct the tests and construct the interval above. No credit will be given if any built-in function related to the t-test is used. You may use the four Base R. functions for a given distribution (e.g., d/p/q/rt()). Your function should perform as follows. i. The function takes the arguments: y1, y2, alt = "two-sided", lev = 0.95, where the equality indicates the default value. The arguments y1 and y2 are the two samples. The argument alt is the alternative hypothesis whose two other possible values are "less" and "greater". The argument lev is the confidence level 1 -a. ii. The function returns an R list containing the test statistic, p-value, and con- fidence interval. (g) Consider the Cars93 dataset in the MASS package. Use your function above to test if the mean city MPG is different for U.S. cars and non-U.S. cars. Draw a conclusion based on a p-value at the 0.05 significance level. Construct and interpret a 95% confidence interval for the mean city MPG difference.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started