It is claimed that the median weight m of certain loads of candy is 40000 pounds.
Use the following 13 observations and the Wilcoxon signed rank statistic to test the null hypothesis H0:m=40000 against the one-sided alternative hypothesis H1:m<40000 at an approximate significance level of α=0.05.
x = np.array([41195, 39485, 38050, 40890, 39245, 31031, 30906, 41229, 36840, 38345, 34930, 40780, 38050])
m = 40000
sign = np.sign(x - m)
rank = np.argsort(np.argsort(np.abs(x - m))) + 1print(f"w = {np.sum(sign * rank)}") # w = -55print(f"y = {np.sum(sign < 0)}") # y = 9
Problem 2
Let X equal the number of milliliters of a liquid in a bottle that has a label volume of 350ml. Assume that the distribution of X is N(μ,4). To test the null hypothesis H0:μ=355 against the alternative hypothesis H1:μ<355, let the critical region be defined by C={x∣x≤354.05}, where x is the sample mean of the contents of a random sample of n=12 bottles.
Find the power function K(μ) for this test.
What is the approximate significance level α of the test?
Use the following 12 observations to state your conclusion from this test:
350353357353352353354354354356355355
Solution.
Recall that
K(μ)=P(reject H0∣μ).
In this problem, we reject H0 if and only if X lands in the critical region, so
K(μ)=P(X≤354.05∣μ).
To calculate this probability, we need to carefully figure out the distribution of X. Recall that
Since the critical region is given to us, we do not use the p-value to make our conclusion. We just check to see if x∈C or not.
x=353.8333≤354.05,
so we reject H0.
Problem 3
In a political campaign, one candidate has a poll taken at random from the voting population. The results of poll are that 311 out of 400 voters favor the candidate. Let p be the fraction of the voting population that favors the candidate.
Test H0:p=0.8 against H1:p<0.8 at significance level α=0.05.
Test H0:p=0.8 against H1:p<0.8 at significance level α=0.01.
Compute the associated p-value.
What is the smallest significance level α for which we can reject H0:p=0.8 in favor of H1:p<0.8?
Solution.
Recall that for one proportion, we use the null hypothesis when computing the standard error:
Z=np0(1−p0)X−p0∼N(0,1).
For our given data, we get
z=4000.8(1−0.8)400311−0.8=−1.125.
The critical region is z<−z0.05=−1.645, so we fail to reject H0.
The critical region is smaller than in part 1, so we still fail to reject H0.
The p-value is (taking the average of Φ(1.12) and Φ(1.13) from the z-table)