0% found this document useful (0 votes)
20 views6 pages

Solutions Week 9

Uploaded by

pranav.garg1006
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views6 pages

Solutions Week 9

Uploaded by

pranav.garg1006
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

Tutorial Solutions : WEEK 9

Topics : Hypothesis Testing

1.
(1) Given that we are examining average back-to-school spending, the parameter of interest
is the population mean μ. Since we want to be able to determine if the population mean
differs from $600 ( μ ≠ 600), we need a two-tailed test and formulate the null and
alternative hypotheses as
H 0 : μ=600
H 1 : μ ≠ 600

* For “=” vs. “≠ type of hypotheses, we will always have the “=” in the H0. More explanation
below.
(2) The study wants to establish that more than 80% of NTU students (p>0.80) are happy
with their campus life. Therefore, the hypotheses are formulated as
H 0 : p ≤ 0.80
H 1 : p> 0.80

Note 1: We put the “research hypothesis,” the new theory to be verified in the research, as
H1.
Our starting position will be that we will assume H0 is true (no effect, no change), unless the
evidence presents itself as strong evidence against H0. Thus, we will not easily conclude the
research hypothesis (H1) is supported and control the risk by choosing α carefully.

Note 2: Like in part (1), we choose to put the equality ( ≥ ∨¿ ≥ ) in H0, instead of H1,
always. it is needed because the “equality” enables us to set a definitive sampling
distribution of X n for hypothesis testing. Only in this way, the rejection region can be
unequivocally defined. Without the “equality” part, we cannot have a fixed benchmark to
derive the distribution.

Note 3: the procedure requires the “research hypothesis” to be H1 also because only in this
way, Type-1 error has a definitive meaning (=wrongly support the research hypothesis). The
hypothesis testing procedure assumes that our main objective is to control the Type-1 error
rate (not so much for the Type-2 error) for the test.

2. (1) It is correct by the definition of rejection region.


(3) Incorrect. A smaller p-value is evidence against H0. Specifically, p-value would become
smaller when the sample mean X ngets further away from the hypothesized mean value
in H0. This would indicate that the sample mean distribution is unlikely to be correct
(hence the μo in H0 would not be correct), because observing such a value of X n is
supposed to have a very low probability (but we still observed it!).

1
Also note that, when you choose a smaller α , the rejection region will get shorter,
lowering the probability of rejecting H0.

(3) Incorrect. The rejection region (RR) corresponds to α , which is something determined by
the researcher. On the other hand, p-value is a statistic that depends on the sample. In other
words, p-value is a random variable. Thus, the RR and the p-value are determined
independently instead of the way stated in the question.

However, it is important to understand how they are used in a hypothesis test.


 The purpose of α is to represent the RR in terms of probability values. As such,
regardless of what units are used or contexts of the tests (e.g., dollars, tons, meters),
the rejection regions across all tests would have a common unit and thus are easy to
understand.
 Since RR now is expressed in α , it is only reasonable for us to convert the sample
mean X n to a similar unit as well, which is why we use p-value.
 Thus, while the original conclusion Rejection/Not is based on whether X n value is in
the RR or not, it can be fully represented by comparing α with the p-value of the
test.

3. For the sake of clarity, suppose H0: μ ≥ $ 100 , H1: μ< $ 100
(1)
 Type-1 error occurs when we reject H0 while H0 is true (false positive). E.g., students
spend at least $100 ( μ ≥ $ 100 ), but the professor concludes otherwise.
 Type-2 error occurs when we do not reject H0 while H0 is false (false negative). E.g.,
students spend less than $100 ( μ< $ 100), but the concludes otherwise

Note that you cannot make Type-1 and Type-2 errors at the same time, because they exist under
two different premises about the value of μ .

(2)
Note that H0: μ ≥ $ 100 , H1: μ< $ 100, α =1%, σ 2is known and is equal to 25.

*Check: the sample size is 35 (>30), which allows us to apply CLT and thus proceed with all the
analysis below.

Pr(Type 1 error) is simply 0.01, the α . This is so because of the definition of α . This also means
that we can control Pr(Type 1 error) by choosing different α value.

The type-2 error probability in this situation is then given by:

Pr ( X 35 is n' t∈the rejection region , given μ=97 )

2
Thus, we must find out the sample mean values that are not in the rejection region. We do this
by first finding where the RR is.

NOTE: We know from the question the true (but unknown) μ=97. Thus, H0 should be rejected
and type-2 error is possible!
Here is how. Given α =1%, we can calculate the rejection region using
qnorm(0.01,100,sqrt(25/35)) and it is approximately { X 35 : X 35< 98.03}. Here we use 100
because, when charting the RR, we assume that H0 is true. For a one-sided hypothesis, we only
need to consider the boundary value in H0, which is $100.

The type-2 error probability in this situation is then given by:

Pr ( X 35 is n' t∈the rejection region , given μ=97 )

¿ Pr ( X 35 ≥ 98.03 ) , givne μ is 97

¿ 1− pnorm ( 98.03 , 97 , √ (25 /35) ) =0.1115

Finally, observe that the Type-2 error probability is much high than the Type-1 error probability.
But this is okay, because we (by assumption) think type-1 error is more serious/costly and want
to prioritize it.

x−μ0 95−100
4. (1) z= = =−2
σ / √ n 10/ √ 16
(2)as z<0, p value=P(Z≤z)=P(Z≤-2)
2*pnorm(-2,0,1)=0.046
(3) We reject the null hypothesis since the p-value 0.046 is less than the significance level
0.10. Thus, at the 10% significance level, we conclude that the population mean differs from
100.

Note: the sample size is only 16 (<30). But we can still proceed because the question also
assumes that population distribution is normal.

5.(1) H 0 : μ ≤ 45, H 1 : μ >45


x−μ0 47−45
(2) z= = =1.41
σ / √ n 8.5/ √ 36
(3) as z>0,p value=P(Z≥ z)=P(Z≥1.41)
1-pnorm(1.41,0,1)=0.079
(4) Do not reject null hypothesis since p-value 0.079 is greater than 0.05. At the 5%
significance level, we cannot conclude that the population mean is greater than 45.

Note: if the “8.5” was the sample standard deviation, we would have to calculate the t-
statistic instead.

3
6. (1)
>
t.test(ChickWeight$weight[ChickWeight$Time==0],ChickWeight$weight[ChickWeight$Time==2])

Welch Two Sample t-test


data: ChickWeight$weight[ChickWeight$Time == 0] and
ChickWeight$weight[ChickWeight$Time == 2]
t = -14.955, df = 58.154, p-value < 2.2e-16
alternative hypothesis: true difference in means is not equal to 0

Since p-value<α , we reject H0 based on the sample.

(2) > t.test(ChickWeight$weight[ChickWeight$Time==0])


One Sample t-test

data: ChickWeight$weight[ChickWeight$Time == 0]
t = 256.42, df = 49, p-value < 2.2e-16
alternative hypothesis: true mean is not equal to 0

Since p-value<α , we reject H0 based on the sample. The value of the t-statistic is 256.42.

7.
(1) We use the t.test command to conduct the two-sample test:
> t.test(airquality$Temp[airquality$Month==6], airquality$Temp[airquality$Month==7])

The p-value = 0.001535. Thus, we reject H0 at 5% significance level.

(2) This is a Week8 refresher question. The t.test command can generate the p-value as well as
the CI (remember the default confidence level is 95%). Thus, we could use

> t.test(airquality$Temp[airquality$Month==6], airquality$Temp[airquality$Month==7], conf.level


= 0.90)

The 90% CI is:


90 percent confidence interval:
-7.204248 -2.402203

(in degree F).

Note that this CI also indicates that the average temperature in June is notably lower than that of
July. This is because the estimated differences are all negative. We also know that the average
temperature in June is lower by 2.4 to 7.2 degrees at the 90% confidence level.

8.
4
(1) As in Question 7, we use t.test command to obtain the 95% CI:
> t.test(ChickWeight$weight[ChickWeight$Time==12])
95 percent confidence interval:
119.4446 139.0452.

(2) To test H0: μ=119.4446,you could calculate the p-value manually, or (recommended) use
t.test again:
> t.test(ChickWeight$weight[ChickWeight$Time==12],mu=119.4446)
p-value = 0.05 (on the dot--not reject)
Similarly,
> t.test(ChickWeight$weight[ChickWeight$Time==12],mu=139.0452)
p-value = 0.05 (on the dot--not reject)

Suppose 125 is chosen. Then


> t.test(ChickWeight$weight[ChickWeight$Time==12],mu=125)
p-value = 0.3882. (not reject)

---------------------
Now, what if we choose a number not in the 90% CI?
> t.test(ChickWeight$weight[ChickWeight$Time==12],mu=140)
p-value = 0.03216
Reject H0 at 5%!
---------------------
From the above numerical experiments, we can observe one important pattern: when we pick a
number from the 95% CI and throw it to H0 of a 5% test, the test will not reject the H0. Similarly,
if we instead pick a number that is not in the CI, the H0 will then be rejected.

This is not a coincidence. This is actually a general rule between CI and hypothesis testing. The
100(1-α ¿ %CI consists of the values that will not be rejected at the test at 100 α % significance
level. For our question, the 95% CI includes all values at which the null hypothesis will not be
rejected (hence “plausible”) at 5%. The following table shows the correspondence between
different confidence levels and α levels:

Confidence levels Total length α levels Rejection region


of the CI of the test
90% Shortest 10% Longest
95% 5%
99% Longest 1% Shortest

Notice the relationship between Total length of the CI and the Rejection region of the test. For
the 90% test, for example, longest rejection region means the same of shortest total length (i.e.,
the range of plausible values)

5
To sum up, here are two important take-way’s from this question. First, the question shows the
correspondence between a confidence interval and the hypothesis tests. Based on a sample, the
CI has values that won’t be rejected at a specific significance level (you can think of “reject” as an
indication of implausibility).

Second, this example also shows that CI contains much richer information than a single
hypothesis test. For example, by this CI, I can conclude any tests based on the values between
139.0452 and 199.4446 will not be rejected at the 5% significance level.

You might also like